mirror of
https://github.com/corazoncp/zoom-sched-poc.git
synced 2026-12-01 04:50:31 +00:00
fix(CR-08): pin uv version, add non-root appuser, and add HEALTHCHECK in Dockerfile
- Pin ghcr.io/astral-sh/uv:0.6.14 instead of :latest - Create non-root appuser owning /app and /app/data - Add HEALTHCHECK polling http://127.0.0.1:8000/health via urllib.request
This commit is contained in:
1 parent
d66ae2641e
commit
2d8f603685
1 file changed
+9
-2
+9
-2
@@ -1,6 +1,6 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
COPY --from=ghcr.io/astral-sh/uv:0.6.14 /uv /usr/local/bin/uv
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -14,8 +14,15 @@ RUN uv sync --no-dev --no-install-project
|
|||||||
COPY app ./app
|
COPY app ./app
|
||||||
COPY static ./static
|
COPY static ./static
|
||||||
|
|
||||||
RUN mkdir -p /app/data
|
RUN useradd --create-home --shell /bin/bash appuser \
|
||||||
|
&& mkdir -p /app/data \
|
||||||
|
&& chown -R appuser:appuser /app
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3)"]
|
||||||
|
|
||||||
CMD ["uv", "run", "--no-dev", "gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--threads", "4", "app:create_app()"]
|
CMD ["uv", "run", "--no-dev", "gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--threads", "4", "app:create_app()"]
|
||||||
Reference in new issue
Block a user