-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile-frontend
35 lines (30 loc) · 1.31 KB
/
Dockerfile-frontend
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
##### Build stage
FROM ubuntu:20.04 as build
RUN apt-get update && apt-get install -y curl wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata \
&& (dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install; rm google-chrome-stable_current_amd64.deb; apt-get clean; ) \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y nodejs
WORKDIR /app
# 1. Only update dependencies when package.json actually changed.
COPY ./frontend/package.json .
COPY ./frontend/package-lock.json .
RUN npm ci
RUN npm run compile-libs
# 2. Test
COPY ./frontend/tsconfig.json .
COPY ./frontend/angular.json .
COPY ./frontend/src/ src/
COPY VERSION src/assets/VERSION
COPY ./frontend/src/assets/hetida_designer_config_docker.json src/assets/hetida_designer_config.json
RUN npm run test-docker
# 3. Do the actual build
ARG configuration=production
RUN npm run build -- --output-path=./dist/out --configuration $configuration
##### Production stage
FROM nginxinc/nginx-unprivileged:1.25.4
COPY --from=build /app/dist/out/ /usr/share/nginx/html
COPY ./frontend/nginx.conf /etc/nginx/nginx.conf
EXPOSE 8080