Skip to content

Commit

Permalink
docker: add tini and use latest alpine image
Browse files Browse the repository at this point in the history
  • Loading branch information
Divkix committed May 31, 2023
1 parent d4e1ff3 commit c09a251
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ RUN CGO_ENABLED=0 GOOS=`go env GOHOSTOS` GOARCH=`go env GOHOSTARCH` go build -o
RUN upx --brute out/aliveimage

# Final Stage: Use a smaller base image and only include necessary files
FROM alpine:3.18
FROM alpine
RUN apk add --no-cache tini
COPY --from=builder /app/out/aliveimage /app/aliveimage
ENV API_LISTEN_PORT=8080
EXPOSE $API_LISTEN_PORT
CMD ["/app/aliveimage"]
ENTRYPOINT ["/sbin/tini", "--", "/app/aliveimage"]

HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD curl --fail http://localhost:$API_LISTEN_PORT/status || exit 1

Expand Down
5 changes: 3 additions & 2 deletions goreleaser.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:3.18
FROM alpine
RUN apk add --no-cache tini
COPY aliveimage /
CMD ["/aliveimage"]
ENTRYPOINT ["/sbin/tini", "--", "/aliveimage"]

HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD curl --fail http://localhost:$API_LISTEN_PORT/status || exit 1

Expand Down

0 comments on commit c09a251

Please sign in to comment.