-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (24 loc) · 785 Bytes
/
Dockerfile
File metadata and controls
31 lines (24 loc) · 785 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
FROM ubuntu:24.04
# Copy uv directly from its image (correct path this time)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install required system dependencies for building Python packages
RUN apt-get update && \
apt-get install -y \
gcc \
python3-dev \
libmagic1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files first
COPY pyproject.toml uv.lock .python-version /app/
WORKDIR /app
# Create virtual environment and install dependencies
ENV PATH="/app/.venv/bin:$PATH"
RUN uv sync --frozen --no-cache
# Copy the project files
COPY . .
# Set default port using ARG and ENV
ARG PORT=8000
ENV PORT=${PORT}
# Default command (can be overridden in compose.yml)
CMD /app/.venv/bin/fastapi run app/main.py --host 0.0.0.0 --port ${PORT}