-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 938 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 938 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
FROM ghcr.io/astral-sh/uv:bookworm-slim
# This will be set by the GitHub action to the folder containing this component.
ARG FOLDER=/app
# This will be set by the GitHub action if "PYTHON_VERSION" ENV is set in diploi.yaml
ARG PYTHON_VERSION=3.12
RUN mkdir -p /.cache/uv && chown -R 1000:1000 /.cache
RUN mkdir -p /.local/share/uv/python && chown -R 1000:1000 /.local/share/uv
COPY --chown=1000:1000 . /app
WORKDIR ${FOLDER}
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
ENV PATH="$FOLDER/.venv/bin:$PATH"
ENV UV_PYTHON=${PYTHON_VERSION}
USER 1000:1000
RUN uv python install ${PYTHON_VERSION} && \
uv venv .venv && \
if [ -f pyproject.toml ]; then \
uv sync --locked --no-dev || uv sync --no-dev; \
elif [ -f requirements.txt ]; then \
uv pip install -r requirements.txt; \
fi
CMD ["uv", "run", "--with", "uvicorn", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]