-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (23 loc) · 924 Bytes
/
Copy pathDockerfile
File metadata and controls
37 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# syntax=docker/dockerfile:1
FROM python:3.12-slim AS build
RUN pip install --no-cache-dir uv
WORKDIR /app
COPY pyproject.toml uv.lock README.md ./
# Install dependencies before copying src/, so this layer only invalidates when
# pyproject.toml or uv.lock change, not on every application code change.
# --no-dev excludes the dev dependency group (pytest, mypy, ruff): only what
# the CLI needs at runtime is installed.
RUN uv sync --locked --no-dev --no-install-project
COPY src/ src/
RUN uv sync --locked --no-dev
FROM python:3.12-slim AS final
RUN useradd --create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /app/.venv /app/.venv
COPY --from=build /app/src /app/src
ENV PATH="/app/.venv/bin:$PATH"
# The non-root user needs write access to /app to create debug/ itself when
# --debug is used without a volume mounted over it.
RUN chown app:app /app
USER app
ENTRYPOINT ["code-audit"]