Skip to content

Commit b6fb79f

Browse files
authored
Merge pull request #190 from LAA-Software-Engineering/fix/135-docker-expose-healthignore
fix(docker): align EXPOSE, healthcheck, build context (#135)
2 parents 5f2fbdf + fdb619d commit b6fb79f

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Git and local env
2+
.git
3+
.gitignore
4+
.env
5+
.env.*
6+
7+
# Local DB data and caches (never belong in the image build context)
8+
.dbdata
9+
**/.dbdata
10+
11+
# Coverage / IDE
12+
coverage.out
13+
coverage.html
14+
.cursor
15+
.idea
16+
.vscode
17+
18+
# Python (e2e / tooling)
19+
__pycache__
20+
.pytest_cache
21+
.venv
22+
venv
23+
24+
# Vendored deps — image uses `go mod download` in the builder stage
25+
vendor/
26+

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ FROM debian:bookworm-slim AS runtime
2020

2121
WORKDIR /app
2222

23+
RUN apt-get update \
24+
&& apt-get install -y --no-install-recommends ca-certificates curl \
25+
&& rm -rf /var/lib/apt/lists/*
26+
2327
RUN useradd --system --no-create-home --uid 10001 appuser
2428

2529
COPY --from=builder /out/server /app/server
@@ -29,6 +33,9 @@ ENV GIN_MODE=release
2933

3034
USER appuser
3135

32-
EXPOSE 8080
36+
EXPOSE 8001
37+
38+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
39+
CMD curl -fsS http://127.0.0.1:8001/api/v1/ >/dev/null || exit 1
3340

3441
CMD ["/app/server"]

0 commit comments

Comments
 (0)