mirror of
https://github.com/versity/versitygw.git
synced 2025-12-23 05:05:16 +00:00
Using Docker ENTRYPOINT should allow for configuration of running versitygw within Docker container similar to how the systemd service is setup with environment variables. This also adds the backends azure and plugin to the acceptable backend options for both docker and systemd. Fixes #1335
39 lines
830 B
Docker
39 lines
830 B
Docker
FROM golang:latest
|
|
|
|
# Set build arguments with default values
|
|
ARG VERSION="none"
|
|
ARG BUILD="none"
|
|
ARG TIME="none"
|
|
|
|
# Set environment variables
|
|
ENV VERSION=${VERSION}
|
|
ENV BUILD=${BUILD}
|
|
ENV TIME=${TIME}
|
|
|
|
WORKDIR /app
|
|
|
|
COPY go.mod ./
|
|
RUN go mod download
|
|
|
|
COPY ./ ./
|
|
|
|
WORKDIR /app/cmd/versitygw
|
|
ENV CGO_ENABLED=0
|
|
RUN go build -ldflags "-X=main.Build=${BUILD} -X=main.BuildTime=${TIME} -X=main.Version=${VERSION}" -o versitygw
|
|
|
|
FROM alpine:latest
|
|
|
|
# These arguments can be overridden when building the image
|
|
ARG IAM_DIR=/tmp/vgw
|
|
ARG SETUP_DIR=/tmp/vgw
|
|
|
|
RUN mkdir -p $IAM_DIR
|
|
RUN mkdir -p $SETUP_DIR
|
|
|
|
COPY --from=0 /app/cmd/versitygw/versitygw /usr/local/bin/versitygw
|
|
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]
|