-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (42 loc) · 1.34 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
FROM node:12 as builder
ARG VUE_APP_ALLOW_UPLOAD=true
ARG VUE_APP_BACKEND_URL
ARG VUE_APP_NONLINEAR_BACKEND
ARG VUE_APP_UPLOAD_URL
ARG VUE_APP_DEBUG=false
ARG MATOMO_URL
ARG MATOMO_ID
ARG VUE_APP_ENABLE_EXPERIMENTAL_FEATURES
ENV MATOMO_URL=$MATOMO_URL
ENV MATOMO_ID=$MATOMO_ID
ENV VUE_APP_ALLOW_UPLOAD=$VUE_APP_ALLOW_UPLOAD
ENV VUE_APP_BACKEND_URL=$VUE_APP_BACKEND_URL
ENV VUE_APP_NONLINEAR_BACKEND=$VUE_APP_NONLINEAR_BACKEND
ENV VUE_APP_ENABLE_EXPERIMENTAL_FEATURES=$VUE_APP_ENABLE_EXPERIMENTAL_FEATURES
ENV VUE_APP_UPLOAD_URL=$VUE_APP_UPLOAD_URL
ENV VUE_APP_DEBUG=$VUE_APP_DEBUG
COPY . /frontend
WORKDIR /frontend/app
RUN npm i
RUN npm run build
# gzipping container
FROM ubuntu:22.04 as compressor
RUN apt upgrade -y && apt update && apt install brotli
RUN mkdir -p /frontend/app
# copy frontend
COPY --from=builder /frontend/app/dist /frontend/app/dist
WORKDIR /frontend/app/dist
RUN for f in $(find . -type f); do gzip < $f > $f.gz && brotli < $f > $f.br; done
# deploy container
FROM python:3.10
RUN pip install -U pip
COPY backend/requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY ./backend/voluba_backend /voluba
RUN chown -R nobody /voluba
WORKDIR /voluba
COPY --from=builder /frontend/app/dist /voluba/public
ENV PATH_TO_STATIC=/voluba/public
USER nobody
EXPOSE 8080
ENTRYPOINT uvicorn app:app --port 8080 --host 0.0.0.0