-
-
Notifications
You must be signed in to change notification settings - Fork 231
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 981 Bytes
/
Dockerfile
File metadata and controls
48 lines (36 loc) · 981 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
41
42
43
44
45
46
47
48
FROM ghcr.io/astral-sh/uv:0.9.12-python3.13-alpine
RUN apk update && apk add --no-cache \
curl \
# For building dependencies. \
gcc \
musl-dev \
git \
g++ \
libffi-dev \
# For psycopg \
postgresql-dev \
# For mysql deps \
mariadb-dev \
# For UI \
ncurses \
bash
RUN adduser -u 1000 --disabled-password fastapi_template
RUN mkdir /projects /src
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
ENV UV_PROJECT_ENVIRONMENT=/usr/local
ENV UV_PYTHON_DOWNLOADS=never
ENV UV_NO_MANAGED_PYTHON=1
WORKDIR /src
COPY . .
ENV PATH="${PATH}:/usr/local/bin"
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
RUN apk del curl
RUN chown -R fastapi_template:fastapi_template /projects /src /usr/local/lib/
USER fastapi_template
RUN git config --global user.name "Fastapi Template"
RUN git config --global user.email "fastapi-template@no-reply.com"
VOLUME /projects
WORKDIR /projects
ENTRYPOINT ["python", "-m", "fastapi_template"]