-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (38 loc) · 1.27 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
48
49
50
51
52
##########
# NODE BUILDER
FROM node:16-alpine AS nbuilder
WORKDIR /frontend/
RUN mkdir /frontend/static/ && mkdir /frontend/static/lib
COPY package*.json /frontend/
RUN npm install
RUN cp /frontend/node_modules/bootstrap/dist/js/bootstrap.bundle.js /frontend/static/lib/
RUN cp -r /frontend/node_modules/bootstrap-icons/icons/ /frontend/static/icons/
COPY frontend/scss/ /frontend/scss/
RUN npm run build
##########
# PYTHON BUILDER
# Create venv with python requirements
FROM python:3.10-alpine as pybuilder
RUN python -m venv /.venv/
RUN apk add --no-cache gcc musl-dev postgresql-dev g++
COPY requirements*.txt /qxsms/
RUN /.venv/bin/pip install --no-cache-dir -r /qxsms/requirements.txt
##########
# MAIN
FROM python:3.10-alpine
# Make app root directory
WORKDIR /qxsms/
RUN adduser -D qxsms -h /qxsms/
# Add venv to path
ENV PATH="/.venv/bin:$PATH"
# Install and get python dependencies
RUN apk add --no-cache postgresql-dev gettext
COPY --from=pybuilder /.venv/ /.venv/
# Get generated css and bootstrap.native js
COPY --from=nbuilder /frontend/static/ /qxsms/static/
# Add the source code in the container
COPY --chown=qxsms:qxsms . /qxsms/
USER qxsms
# Env variable created at build time to be able to get the version without .git
ARG QXSMS_VERSION
ENV QXSMS_VERSION=$QXSMS_VERSION