Initial commit
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# The whole server is the Python standard library, so the image needs no build
|
||||
# toolchain, no wheels and no virtual environment -- just an interpreter, a trust
|
||||
# store for upstream TLS, and the code.
|
||||
FROM python:3.13-alpine
|
||||
|
||||
RUN apk add --no-cache ca-certificates \
|
||||
&& adduser -D -u 10001 -h /srv app
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
CONFIG_PATH=/config/config.json
|
||||
|
||||
WORKDIR /srv
|
||||
COPY app/ ./app/
|
||||
COPY config.example.json ./
|
||||
|
||||
# Runs as an unprivileged user with no writable path: the server keeps nothing on
|
||||
# disk, so the container can be run read-only (see docker-compose.yaml).
|
||||
USER app
|
||||
EXPOSE 8080
|
||||
|
||||
# The health endpoint answers without credentials and never calls upstream, so
|
||||
# this checks the process, not the network.
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD ["python", "-c", "import sys, urllib.request; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=4).status == 200 else 1)"]
|
||||
|
||||
ENTRYPOINT ["python", "-m", "app"]
|
||||
Reference in New Issue
Block a user