-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 1006 Bytes
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 1006 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
38
39
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.11-bookworm
# This will be set by the GitHub action to the folder containing this component.
ARG FOLDER=/app
WORKDIR ${FOLDER}
# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1
# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy
# Ensure installed tools can be executed out of the box
ENV UV_TOOL_BIN_DIR=/usr/local/bin
COPY . /app
RUN if [ -f requirements.txt ]; then \
echo "requirements.txt found, installing dependencies with uv pip" && \
uv venv .venv --clear && \
uv pip install -r requirements.txt; \
else \
echo "Using uv sync for dependency installation" && \
uv sync --locked --no-dev; \
fi
# Place executables in the environment at the front of the path
ENV PATH="$FOLDER/.venv/bin:$PATH"
# Reset the entrypoint, don't invoke `uv`
ENTRYPOINT []
EXPOSE 8000
ENV PORT=8000
ENV HOST="0.0.0.0"
CMD ["uv", "run", "--frozen", "src/main.py"]