forked from ITISFoundation/IEC62209-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
85 lines (58 loc) · 1.77 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
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
84
85
FROM python:3.10-slim-buster as base
LABEL maintainer=pcrespov
ENV LANG=C.UTF-8 \
PYTHONDONTWRITEBYTECODE=1
ENV SC_USER_ID=8004 \
SC_USER_NAME=scu \
VIRTUAL_ENV=/home/scu/.venv
RUN adduser \
--uid ${SC_USER_ID} \
--disabled-password \
--gecos "" \
--shell /bin/sh \
--home /home/${SC_USER_NAME} \
${SC_USER_NAME}
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
RUN apt-get update && apt-get install -y \
texlive \
texlive-latex-extra
EXPOSE 8000
# -------------------------- Build stage -------------------
FROM base as build
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git\
curl \
gnupg \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y \
nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& git --version \
&& node --version \
&& python --version
USER scu
RUN python -m venv "${VIRTUAL_ENV}"
RUN which pip \
&& pip --no-cache-dir install --upgrade \
pip~=23.0 \
wheel \
setuptools
WORKDIR /build
COPY --chown=scu:scu server server
RUN cd server \
&& pip --no-cache-dir install -r requirements.txt \
&& pip --no-cache-dir install .
COPY --chown=scu:scu client client
RUN cd client \
&& npm install \
&& npx qx compile --debug --clean
# --------------------------Production stage -------------------
FROM base as production
USER scu
ENV PYTHONOPTIMIZE=TRUE
ENV CLIENT_OUTPUT_DIR=/home/scu/client
WORKDIR /home/scu
COPY --chown=scu:scu --from=build ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY --chown=scu:scu --from=build /build/client/compiled/source ${CLIENT_OUTPUT_DIR}
CMD [ "uvicorn", "iec62209_service.main:the_app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "warning"]