Repository navigation
Expand file tree
/
Copy pathDockerfile.fullstack
More file actions
83 lines (72 loc) · 2.92 KB
/
Copy pathDockerfile.fullstack
File metadata and controls
83 lines (72 loc) · 2.92 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM node:26-alpine AS frontend-build
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend ./
ARG VITE_API_BASE_URL=/api/v1
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
RUN npm run build
FROM python:3.14-slim
ARG OCI_TITLE="OpenZEV Fullstack"
ARG OCI_DESCRIPTION="OpenZEV fullstack container with backend API and frontend assets"
ARG OCI_URL="https://github.com/splattner/openzev"
ARG OCI_SOURCE="https://github.com/splattner/openzev"
ARG OCI_VENDOR="OpenZEV"
ARG OCI_LICENSES="AGPL-3.0"
ARG OCI_AUTHORS="OpenZEV Contributors"
ARG OCI_VERSION="dev"
ARG OCI_REVISION="unknown"
ARG OCI_CREATED="unknown"
LABEL org.opencontainers.image.title="$OCI_TITLE" \
org.opencontainers.image.description="$OCI_DESCRIPTION" \
org.opencontainers.image.url="$OCI_URL" \
org.opencontainers.image.source="$OCI_SOURCE" \
org.opencontainers.image.vendor="$OCI_VENDOR" \
org.opencontainers.image.licenses="$OCI_LICENSES" \
org.opencontainers.image.authors="$OCI_AUTHORS" \
org.opencontainers.image.version="$OCI_VERSION" \
org.opencontainers.image.revision="$OCI_REVISION" \
org.opencontainers.image.created="$OCI_CREATED"
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
XDG_CACHE_HOME=/tmp/openzev-cache
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
pkg-config \
default-libmysqlclient-dev \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libcairo2 \
libffi-dev \
shared-mime-info \
fonts-inter \
fonts-liberation \
fonts-noto \
nginx \
&& rm -rf /var/lib/apt/lists/*
# The PDFs are set in Inter; without it fontconfig falls back to another face
# silently, so fail the build instead.
RUN test "$(fc-match -f '%{family[0]}' Inter)" = Inter \
|| { echo "fonts-inter is not installed: the PDFs would not render in Inter" >&2; exit 1; }
COPY backend/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt && \
pip install --no-cache-dir mysqlclient
RUN groupadd --system --gid 10001 openzev \
&& useradd --system --uid 10001 --gid openzev --home /app openzev
COPY backend /app
COPY --from=frontend-build /frontend/dist /usr/share/nginx/html
COPY docker/fullstack-nginx.conf /etc/nginx/conf.d/default.conf
COPY docker/start-fullstack.sh /start-fullstack.sh
# Remove the Debian site and use writable nginx runtime paths.
RUN chmod +x /start-fullstack.sh \
&& rm -f /etc/nginx/sites-enabled/default \
&& sed -i '/^user[[:space:]]/d' /etc/nginx/nginx.conf \
&& sed -i -e 's#^\(\s*\)error_log[[:space:]].*#\1error_log /dev/stderr warn;#' /etc/nginx/nginx.conf \
&& mkdir -p /var/cache/nginx /var/log/nginx /var/lib/nginx /app/media \
&& sed -i 's#^pid[[:space:]].*#pid /tmp/nginx.pid;#' /etc/nginx/nginx.conf \
&& chown -R 10001:10001 /app/media /var/cache/nginx /var/log/nginx /var/lib/nginx
USER 10001:10001
EXPOSE 8080
CMD ["/start-fullstack.sh"]