-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 1.3 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (26 loc) · 1.3 KB
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
# syntax=docker/dockerfile:1
FROM python:3.11-slim
# Install uv from official image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# System dependencies + SQL Server ODBC driver
RUN apt-get update && \
apt-get install -y --no-install-recommends curl gnupg2 ca-certificates unixodbc-dev build-essential && \
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg && \
echo "deb [signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql18 && \
DRIVER_PATH="$(ls /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18*.so* | head -n 1)" && \
printf "[SQL Server]\nDescription=Microsoft ODBC Driver 18 for SQL Server (alias)\nDriver=%s\nUsageCount=1\n" "$DRIVER_PATH" >> /etc/odbcinst.ini && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV UV_PYTHON=python3.11
ENV UV_SYSTEM_PYTHON=1
# Install dependencies first for better layer caching
COPY pyproject.toml ./
COPY uv.lock ./
RUN uv sync --frozen
# Copy project files
COPY . .
# Runtime default environment for main.py arg
ENV APP_ENV=hpc_dev
CMD ["sh", "-c", "uv run python main.py --db"]