This repository has been archived by the owner on May 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
68 lines (41 loc) · 1.51 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
################ Build ################
FROM node:12.6-alpine AS builder
WORKDIR /app
# Copy project files to the docker image (except .dockerignore)
COPY . .
# Install Angular cli
RUN npm install @angular/[email protected] -g
# Install packages
RUN npm install
# Build Angular
RUN ng build --configuration=docker
################ Build ################
################ Serve ################
FROM nginx:alpine
############### Set Defualt Value ################
ENV TRACER_ENV_TracingProviderName=NotExists
ENV TRACER_ENV_TracingProviderUrl=NotExists
############### Set Defualt Value ################
# Dist artifacts to default nginx public folder
COPY --from=builder /app/dist /usr/share/nginx/html
############### EntryPoint ###############
# This entrypoint is setting the env into the main.js before the nginx start on docker run
# Install bash
RUN apk add --update bash
# COPY the entrypoint
COPY --from=builder /app/docker-entrypoint.sh /entrypoint.sh
#Add permissin to entrypoint
RUN chmod +x ./entrypoint.sh
# Set entrypoint format to linux
RUN dos2unix entrypoint.sh
# set entry point--> ENTRYPOINT ./entrypoint.sh has less clear errors
ENTRYPOINT ["bin/bash", "./entrypoint.sh"]
############### entry point ###############
# Start nginx
CMD ["nginx", "-g", "daemon off;"]
EXPOSE 80
################ Serve ################
#### Debug Container Output
# docker run -it --rm tracer "/bin/ash"
### Extract ENV Form Container Shell
# cat "$( ls /usr/share/nginx/html/main.*js)"| grep "tracingProvider[ \t]*:[^}]*" -o