-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 1.23 KB
/
Dockerfile
File metadata and controls
49 lines (35 loc) · 1.23 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM node:18-alpine AS frontend
COPY server/frontend /src
RUN chown -R node:node /src
USER node
WORKDIR /src
RUN npm install
RUN npm run production
FROM ubuntu:25.10 AS backend
RUN apt-get update && \
apt-get install -y --no-install-recommends \
bash \
build-essential \
git \
libmariadb-dev \
mariadb-client \
openssh-client \
pkg-config && \
rm -rf /var/lib/apt/lists/* /var/log/*
RUN adduser --disabled-password worker
COPY --from=ghcr.io/astral-sh/uv:0.10.2 /uv /uvx /bin/
COPY . /src/
# Retrieve previous Javascript build
COPY --from=frontend /src/dist/ /src/server/frontend/dist/
RUN chown -R worker:worker /src
USER worker
RUN cd /src && uv sync --locked --extra=server --extra=docker
# Use a custom settings file that can be overwritten
ENV DJANGO_SETTINGS_MODULE="server.settings_docker"
WORKDIR /src/server
# Collect staticfiles, including Vue.js build
RUN uv run --extra=server --extra=docker manage.py collectstatic --no-input
# Run with gunicorn, using container's port 80
ENV PORT=80
EXPOSE 80
CMD ["uv", "run", "--extra", "server", "--extra", "docker", "gunicorn", "--bind", "0.0.0.0:80", "--error-logfile", "-", "--access-logfile", "-", "--capture-output", "server.wsgi"]