-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (57 loc) · 1.46 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
FROM node:18 as backend
WORKDIR /opt/app
COPY backend/tsconfig.json .
COPY backend/package.json .
COPY backend/package-lock.json .
RUN npm ci
COPY backend/src src
CMD ["npm", "run", "start"]
EXPOSE 80
####################################
# frontend ('f-' Prefix)
####################################
FROM node:18 as f-file-loader
WORKDIR /data
COPY frontend/package.json .
COPY frontend/package-lock.json .
COPY frontend/tsconfig.json .
COPY frontend/tsconfig.node.json .
COPY frontend/tsconfig.app.json .
COPY frontend/env.d.ts .
COPY frontend/vite.config.ts .
FROM node:18 as f-dependencyfetcher
WORKDIR /build
COPY --from=f-file-loader /data .
RUN npm install
FROM f-dependencyfetcher as f-build-files
WORKDIR /build
RUN mkdir src
COPY frontend/src ./src
COPY frontend/index.html .
COPY frontend/public ./public
# Prod builds
FROM f-build-files as f-prod
ARG PRODUCTION
ENV VITE_PRODUCTION=$PRODUCTION
ARG DOMAIN
ENV VITE_DOMAIN=$DOMAIN
ARG PROTOCOL
ENV VITE_PROTOCOL=$PROTOCOL
ARG TRAEFIK
ENV VITE_TRAEFIK=$TRAEFIK
ARG BACKEND_PORT
ENV VITE_BACKEND_PORT=$BACKEND_PORT
ARG PRODUCTION_ADDRESS
ENV VITE_PRODUCTION_ADDRESS=$PRODUCTION_ADDRESS
ARG DEV_SERVER
ENV VITE_DEV_SERVER=$DEV_SERVER
ARG LIT_DOMAIN
ENV VITE_LIT_DOMAIN=$LIT_DOMAIN
ARG LIT_PROJECT
ENV VITE_LIT_PROJECT=$LIT_PROJECT
RUN npm run build
# TODO Add Linter
FROM nginx:1.22.1 as frontend
COPY frontend/docker/remote.nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=f-prod /build/dist /usr/share/nginx/html
EXPOSE 80