Add server healthcheck

This commit is contained in:
Andras Schmelczer 2025-01-04 10:34:34 +00:00
parent b2ecb98ec6
commit 3ae0e7b896
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 19 additions and 2 deletions

View file

@ -1,4 +1,9 @@
target
Dockerfile
.dockerignore
db.sqlite3
db.sqlite3*
*.log
sync_lib/pkg
fuzz/artifacts
fuzz/corpus
fuzz/coverage

View file

@ -14,10 +14,22 @@ RUN sqlx migrate run --source sync_server/src/database/migrations --database-url
RUN cargo build --package sync_server --release --target x86_64-unknown-linux-musl
# Runtime image
FROM alpine:3.21.0
LABEL org.opencontainers.image.authors="andras@schmelczer.dev"
RUN apk add --no-cache curl
COPY --from=builder /usr/src/backend/target/x86_64-unknown-linux-musl/release/sync_server /app/sync_server
WORKDIR /data
WORKDIR /app
EXPOSE 3000/tcp
HEALTHCHECK \
--interval=30s \
--timeout=5s \
CMD curl -f http://localhost:3000/ping || exit 1
ENTRYPOINT ["/app/sync_server"]