chore: Commen the Dockerfile

This commit is contained in:
daniele 2023-03-25 11:18:42 +02:00 committed by daniele
parent 1c870d80f9
commit f1d2fb5bdf

View file

@ -27,6 +27,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build \
-o /go/bin/api \
-v ./app/api/*.go && \
chmod +x /go/bin/api && \
# create a directory so that we can copy it in the next stage
mkdir /data
# Production Stage
@ -36,6 +37,8 @@ ENV HBOX_MODE=production
ENV HBOX_STORAGE_DATA=/data/
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
# Copy the binary and the (empty) /data dir and
# change the ownership to the low-privileged user
COPY --from=builder --chown=nonroot /go/bin/api /app/api
COPY --from=builder --chown=nonroot /data /data
@ -45,6 +48,7 @@ EXPOSE 7745
WORKDIR /app
VOLUME [ "/data" ]
# Drop root and run as low-privileged user
USER nonroot
ENTRYPOINT [ "/app/api" ]
CMD [ "/data/config.yml" ]