Store git tag, commit hash, and build date as OCI-standard labels and a build_meta.json file inside the Docker image. The Flask app reads this at startup and displays version info in all page footers. Adds /version JSON endpoint for programmatic access. Falls back to dev@local outside Docker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
FROM python:3.13-alpine
|
|
|
|
RUN apk add --no-cache bash tzdata \
|
|
&& cp /usr/share/zoneinfo/Europe/Prague /etc/localtime \
|
|
&& echo "Europe/Prague" > /etc/timezone
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
|
|
RUN pip install --no-cache-dir \
|
|
flask \
|
|
google-api-python-client \
|
|
google-auth-httplib2 \
|
|
google-auth-oauthlib \
|
|
qrcode \
|
|
pillow \
|
|
gunicorn
|
|
|
|
COPY app.py Makefile ./
|
|
COPY scripts/ ./scripts/
|
|
COPY templates/ ./templates/
|
|
|
|
COPY build/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ARG GIT_TAG=unknown
|
|
ARG GIT_COMMIT=unknown
|
|
ARG BUILD_DATE=unknown
|
|
|
|
LABEL org.opencontainers.image.version="${GIT_TAG}" \
|
|
org.opencontainers.image.revision="${GIT_COMMIT}" \
|
|
org.opencontainers.image.created="${BUILD_DATE}" \
|
|
org.opencontainers.image.title="fuj-management"
|
|
|
|
RUN echo "{\"tag\": \"${GIT_TAG}\", \"commit\": \"${GIT_COMMIT}\", \"build_date\": \"${BUILD_DATE}\"}" > /app/build_meta.json
|
|
|
|
EXPOSE 5001
|
|
|
|
HEALTHCHECK --interval=60s --timeout=5s --start-period=5s \
|
|
CMD wget -q -O /dev/null http://localhost:5001/ || exit 1
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|