-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 885 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 885 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
FROM python:3.12-slim-bookworm
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc curl ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Download the latest installer
ADD https://astral.sh/uv/install.sh /uv-installer.sh
# Run the installer then remove it
RUN sh /uv-installer.sh && rm /uv-installer.sh
# Ensure the installed binary is on the PATH
ENV PATH="/root/.local/bin/:$PATH"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app
# Copy the application into the container
COPY . /app
# Install the application dependencies
WORKDIR /app
# First regenerate the lockfile, then sync
RUN uv lock
RUN uv sync
# Expose port
EXPOSE 8000
# Run uvicorn through uv
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]