2021-12-09 05:47:48 +03:00
|
|
|
# Build
|
|
|
|
FROM golang:alpine AS build
|
|
|
|
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
|
|
|
|
RUN apk add --no-cache -U build-base git make
|
|
|
|
|
|
|
|
RUN mkdir -p /src
|
|
|
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
# Copy Makefile
|
|
|
|
COPY Makefile ./
|
|
|
|
|
|
|
|
# Install deps
|
|
|
|
RUN make deps
|
|
|
|
|
|
|
|
# Copy content
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Build the site
|
|
|
|
RUN make build
|
|
|
|
|
|
|
|
# Runtime
|
2023-03-11 09:55:59 +03:00
|
|
|
FROM alpine AS runtime
|
|
|
|
|
|
|
|
RUN apk --no-cache -U add su-exec shadow
|
|
|
|
|
|
|
|
ENV PUID=10000
|
|
|
|
ENV PGID=10000
|
|
|
|
|
|
|
|
RUN addgroup -g "${PGID}" zs && \
|
|
|
|
adduser -D -H -G zs -h /var/empty -u "${PUID}" zs && \
|
|
|
|
mkdir -p /data && chown -R zs:zs /data
|
|
|
|
|
|
|
|
EXPOSE 8000
|
2021-12-09 05:47:48 +03:00
|
|
|
|
|
|
|
VOLUME /data
|
|
|
|
|
2023-03-11 09:55:59 +03:00
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
COPY --from=build /go/bin/static /usr/local/bin/static
|
2021-12-09 05:47:48 +03:00
|
|
|
COPY --from=build /src/.pub /data
|
|
|
|
|
2023-03-11 09:55:59 +03:00
|
|
|
COPY .dockerfiles/entrypoint.sh /init
|
|
|
|
|
|
|
|
ENTRYPOINT ["/init"]
|
|
|
|
|
|
|
|
CMD ["static", "-n", "-s", "-r", "/data"]
|