You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
FROM golang:alpine AS build
|
|
|
|
ARG BLD_REPO=${BLD_REPO:-https://github.com/horgh/catbox.git}
|
|
ARG BLD_VER=${BLD_VER:-master}
|
|
|
|
ARG GOOS
|
|
ARG GOARCH
|
|
|
|
RUN apk --update add \
|
|
git
|
|
|
|
RUN git clone \
|
|
--depth 1 \
|
|
--single-branch \
|
|
--branch ${BLD_VER} \
|
|
${BLD_REPO} \
|
|
/srv/src/catbox
|
|
|
|
WORKDIR /srv/src/catbox
|
|
|
|
RUN GOOS=${GOOS} \
|
|
GOARCH=${GOARCH} \
|
|
CGO_ENABLED=0 \
|
|
go build \
|
|
--installsuffix cgo \
|
|
--ldflags "-w -s" \
|
|
-o "/srv/dist/catbox" \
|
|
.
|
|
|
|
RUN cp -r /srv/src/catbox/conf /srv/dist/conf && \
|
|
sed -i 's|#opers-config =|opers-config = /srv/data/conf/opers.conf|g' /srv/dist/conf/catbox.conf && \
|
|
sed -i 's|#servers-config =|servers-config = /srv/data/conf/servers.conf|g' /srv/dist/conf/catbox.conf && \
|
|
sed -i 's|#users-config =|users-config = /srv/data/conf/users.conf|g' /srv/dist/conf/catbox.conf
|
|
|
|
FROM alpine:latest
|
|
|
|
RUN adduser -D catbox
|
|
|
|
COPY --from=build --chown=catbox /srv/dist /srv/catbox
|
|
|
|
COPY root/ /
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|