build: Dockerfile non-root user, healthcheck, .dockerignore
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
.git
|
.git
|
||||||
node_modules
|
*.md
|
||||||
.DS_Store
|
!README.md
|
||||||
bin/
|
chatd
|
||||||
|
chat-cli
|
||||||
data.db
|
data.db
|
||||||
|
data.db-wal
|
||||||
|
data.db-shm
|
||||||
.env
|
.env
|
||||||
*.test
|
|
||||||
*.out
|
|
||||||
debug.log
|
|
||||||
|
|||||||
@@ -18,8 +18,12 @@ RUN CGO_ENABLED=1 go build -trimpath -ldflags="-s -w" -o /chat-cli ./cmd/chat-cl
|
|||||||
|
|
||||||
# Final stage — server only
|
# Final stage — server only
|
||||||
FROM alpine:3.21
|
FROM alpine:3.21
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates \
|
||||||
|
&& addgroup -S chat && adduser -S chat -G chat
|
||||||
COPY --from=builder /chatd /usr/local/bin/chatd
|
COPY --from=builder /chatd /usr/local/bin/chatd
|
||||||
|
|
||||||
|
USER chat
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD wget -qO- http://localhost:8080/.well-known/healthcheck.json || exit 1
|
||||||
ENTRYPOINT ["chatd"]
|
ENTRYPOINT ["chatd"]
|
||||||
|
|||||||
Reference in New Issue
Block a user