-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 805 Bytes
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 805 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
40
FROM python:3.10-slim AS build
# prevent .pyc files, -B
ENV PYTHONDONTWRITEBYTECODE 1
# prevent buffering, -u
ENV PYTHONUNBUFFERED 1
WORKDIR /app
# psycopg2 need libpq-dev and gcc
RUN apt-get update && apt-get install -y libpq-dev gcc
# install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# copy all files
COPY . .
# install dependencies using uv
RUN uv sync --frozen
# multi stage
FROM python:3.10-slim AS runtime
WORKDIR /app
# runtime dependencies, cache
RUN apt-get update && apt-get install -y \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# copy uv binary
COPY --from=build /bin/uv /bin/uvx /bin/
# copy all files
COPY --from=build /app /app
WORKDIR /app/thesis
# config file by default: ./gunicorn.conf.py
CMD [ "uv", "run", "gunicorn", "thesis.wsgi:application" ]