Skip to content

Commit

Permalink
Update base images and introduce health endpoint (ankitects#3273)
Browse files Browse the repository at this point in the history
* Update base images and introduce health endpoint

sync-server: introduce `/health` endpoint to check if the service is reachable.

bump(alpine): bump alpine base image from `3.19` to `3.20`

bump(rust): bump rust-alpine build image from `1.76` to `1.79`

* fix cargo fmt

* add allow clippy::extra_unused_type_parameters

* Remove unused type param (dae)

* Route /health directly (dae)

* Fix for latest axum (dae)
  • Loading branch information
jeankhawand committed Aug 7, 2024
1 parent 712fd38 commit 96aaa2a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/syncserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM rust:1.76-alpine3.19 AS builder
FROM rust:1.79-alpine3.20 AS builder

ARG ANKI_VERSION="23.12.1"

RUN apk update && apk add --no-cache build-base protobuf && rm -rf /var/cache/apk/*
RUN cargo install --git https://github.com/ankitects/anki.git \
--tag ${ANKI_VERSION} \
--root /anki-server \
anki-sync-server
--tag ${ANKI_VERSION} \
--root /anki-server \
anki-sync-server

FROM alpine:3.19.1
FROM alpine:3.20

RUN adduser -D -h /home/anki anki

Expand All @@ -25,8 +25,9 @@ EXPOSE ${SYNC_PORT}

CMD ["anki-sync-server"]

# TODO - consider exposing endpoint /health to check on health cause currently it will return 404 error
# HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
# CMD wget -qO- http://localhost:${SYNC_PORT} || exit 1
# This health check will work for Anki versions 24.06.3 and newer.
# For older versions, it may incorrectly report an unhealthy status, which should not be the case.
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:${SYNC_PORT}/health || exit 1

LABEL maintainer="Jean Khawand <jk@jeankhawand.com>"

0 comments on commit 96aaa2a

Please sign in to comment.