-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 943 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (26 loc) · 943 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
# syntax=docker/dockerfile:1.7
FROM python:3.12-slim-bullseye AS base
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV POETRY_VIRTUALENVS_CREATE=false
ENV POETRY_SYSTEM_GIT_CLIENT=true
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git && \
rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir poetry
COPY pyproject.toml poetry.lock ./
FROM base AS deps-git
# Consumer-style builds install dependencies from the locked Poetry graph.
RUN --mount=type=secret,id=github_token git config --global \
url."https://x-access-token:$(cat /run/secrets/github_token)@github.com/".insteadOf \
ssh://git@github.com/ \
&& poetry install --only main --no-root \
&& rm -f /root/.gitconfig
FROM deps-git AS dev-git
COPY . .
ENV PYTHONPATH=/app
CMD ["uvicorn", "--reload", "--host", "0.0.0.0", "--app-dir", "src/server", "main:app"]