@@ -12,18 +12,17 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
1212
1313WORKDIR /app
1414
15- # Copy uv from official image for better security and updates
1615COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
1716
1817COPY pyproject.toml uv.lock ./
1918
2019RUN --mount=type=cache,target=/root/.cache/uv \
21- uv sync --locked --no-install-project
20+ uv sync --locked --no-dev --no- install-project
2221
2322COPY . .
2423
2524RUN --mount=type=cache,target=/root/.cache/uv \
26- uv sync --locked
25+ uv sync --locked --no-dev
2726
2827# --- Runtime stage ---
2928FROM python:${PYTHON_VERSION}-slim
@@ -37,23 +36,20 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
3736
3837WORKDIR /app
3938
40- RUN groupadd -r appuser && \
41- useradd -r -g appuser -u 1000 -s / sbin/nologin appuser
39+ RUN groupadd --system flowdacity && \
40+ useradd --system --gid flowdacity --uid 1000 --create-home --shell /usr/ sbin/nologin flowdacity
4241
43- COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
42+ COPY --from=builder --chown=flowdacity:flowdacity /app/.venv /app/.venv
43+ COPY --from=builder --chown=flowdacity:flowdacity /app /app
4444
45- COPY --chown=appuser:appuser . .
45+ RUN chmod -R a-w /app && \
46+ chmod -R u+rwX /app
4647
47- RUN chmod -R 555 /app/fq_server && \
48- chmod 555 /app/*.py && \
49- chmod 444 /app/default.conf /app/pyproject.toml
50-
51- USER appuser
48+ USER flowdacity
5249
5350EXPOSE ${PORT}
5451
5552HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
56- CMD python -c "import os, httpx; port = os.environ.get('PORT', '8080'); httpx.get(f'http://127.0.0.1:{port}/metrics/')" || exit 1
53+ CMD python -c "import os, httpx; port = os.environ.get('PORT', '8080'); r = httpx.get(f'http://127.0.0.1:{port}/metrics/'); raise SystemExit(0 if r.status_code < 400 else 1)"
5754
58- ENTRYPOINT ["sh" , "-c" ]
59- CMD exec uvicorn asgi:app --host 0.0.0.0 --port ${PORT}
55+ CMD ["sh" , "-c" , "exec uvicorn asgi:app --host 0.0.0.0 --port ${PORT}" ]
0 commit comments