mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-03 08:10:28 +00:00
feat: use distroless image and non-root user
This commit is contained in:
parent
c1957bb927
commit
b82725f1f4
1 changed files with 17 additions and 2 deletions
19
Dockerfile
19
Dockerfile
|
@ -25,20 +25,31 @@ COPY --from=frontend-builder /app/.output/public ./app/api/static/public
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build \
|
RUN CGO_ENABLED=0 GOOS=linux go build \
|
||||||
-ldflags "-s -w -X main.commit=$COMMIT -X main.buildTime=$BUILD_TIME -X main.version=$VERSION" \
|
-ldflags "-s -w -X main.commit=$COMMIT -X main.buildTime=$BUILD_TIME -X main.version=$VERSION" \
|
||||||
-o /go/bin/api \
|
-o /go/bin/api \
|
||||||
-v ./app/api/*.go
|
-v ./app/api/*.go && \
|
||||||
|
chmod +x /go/bin/api && \
|
||||||
|
mkdir /data
|
||||||
|
|
||||||
# Production Stage
|
# Production Stage
|
||||||
FROM alpine:latest
|
FROM gcr.io/distroless/static
|
||||||
|
|
||||||
ENV HBOX_MODE=production
|
ENV HBOX_MODE=production
|
||||||
ENV HBOX_STORAGE_DATA=/data/
|
ENV HBOX_STORAGE_DATA=/data/
|
||||||
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
|
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
RUN apk --no-cache add ca-certificates
|
RUN apk --no-cache add ca-certificates
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
COPY --from=builder /go/bin/api /app
|
COPY --from=builder /go/bin/api /app
|
||||||
|
|
||||||
RUN chmod +x /app/api
|
RUN chmod +x /app/api
|
||||||
|
=======
|
||||||
|
ENV USER=appuser
|
||||||
|
ENV UID=1001
|
||||||
|
ENV GID=1001
|
||||||
|
|
||||||
|
COPY --from=builder --chown=nonroot /go/bin/api /app/api
|
||||||
|
COPY --from=builder --chown=nonroot /data /data
|
||||||
|
>>>>>>> bc9d021... feat: use distroless image and non-root user
|
||||||
|
|
||||||
LABEL Name=homebox Version=0.0.1
|
LABEL Name=homebox Version=0.0.1
|
||||||
LABEL org.opencontainers.image.source="https://github.com/hay-kot/homebox"
|
LABEL org.opencontainers.image.source="https://github.com/hay-kot/homebox"
|
||||||
|
@ -46,5 +57,9 @@ EXPOSE 7745
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
VOLUME [ "/data" ]
|
VOLUME [ "/data" ]
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
USER nonroot
|
||||||
|
>>>>>>> bc9d021... feat: use distroless image and non-root user
|
||||||
ENTRYPOINT [ "/app/api" ]
|
ENTRYPOINT [ "/app/api" ]
|
||||||
CMD [ "/data/config.yml" ]
|
CMD [ "/data/config.yml" ]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue