-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (34 loc) · 1.08 KB
/
Dockerfile
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
FROM ghcr.io/astral-sh/uv:bookworm-slim AS base
COPY .python-version pyproject.toml uv.lock /app/
WORKDIR /app
RUN --mount=type=cache,target=/app/.cache \
uv python install && \
uv venv && \
uv sync --no-install-project --no-dev --extra production
################################################################################
FROM base AS build
COPY . /app
WORKDIR /app
RUN --mount=type=cache,target=/app/.cache \
uv sync --dev --no-install-project && \
uv build
################################################################################
FROM base
COPY docker/entrypoint.sh /
COPY docker/django_init.d /django_init.d
RUN --mount=type=cache,target=/app/.cache \
--mount=type=bind,from=build,source=/app/dist,target=/app/dist \
uv pip install /app/dist/*.whl
ENV PATH="/app/.venv/bin:$PATH"
ARG DJANGO_SITE="myproject"
ENV DJANGO_SETTINGS_MODULE="$DJANGO_SITE.settings"
ARG WEB_CONCURRENCY=4
ENV WEB_CONCURRENCY=$WEB_CONCURRENCY
ENV DEBUG=off
ARG HOST=0.0.0.0
ENV HOST=$HOST
ARG PORT=8000
ENV PORT=$PORT
EXPOSE $PORT
ENTRYPOINT ["/entrypoint.sh"]
CMD []