-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile_static
31 lines (22 loc) · 991 Bytes
/
Dockerfile_static
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
# https://cli.vuejs.org/guide/deployment.html#docker-nginx
FROM nikolaik/python-nodejs:python3.11-nodejs18 AS build-stage
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
WORKDIR /workdir
COPY frontend/package*.json ./
RUN npm install
COPY . .
ENV DJANGO_ENV=production
WORKDIR /workdir/frontend
RUN npx gettext-compile --output src/translations/translations.json locale/*/lang.po || true
RUN npx vue-cli-service build
WORKDIR /workdir
RUN python manage.py collectstatic --noinput -v2
FROM nginxinc/nginx-unprivileged:latest AS production-stage
USER root
COPY --from=build-stage --chown=nginx:root /workdir/frontend/dist /usr/share/nginx/html
COPY --from=build-stage --chown=nginx:root /workdir/static /usr/share/nginx/html/static
COPY --chown=nginx:root frontend/default.conf /etc/nginx/conf.d/default.conf
# Must match the settings.MEDIA_ROOT default value.
RUN mkdir -p /data/media && chown -R nginx:root /data/media
USER nginx