-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathDockerfile
35 lines (30 loc) · 990 Bytes
/
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
FROM node:16 AS builder
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN yarn install --network-timeout 600000
COPY src/ src
COPY types/ types
COPY nginx.conf .
COPY public/ public/
COPY tsconfig.json .
COPY . .
RUN echo REACT_APP_GIT_SHA=`git rev-parse --short HEAD` >> .env.production
RUN echo `git rev-parse --short HEAD` > health.html
RUN npm run build
#RUN apt update -y && apt install jq -y
#RUN python linter.py | jq -C --tab .
FROM nginx:stable
RUN useradd -ms /bin/bash devtron
COPY --from=builder /app/build/ /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/./env.sh .
COPY --from=builder /app/.env .
COPY --from=builder /app/health.html .
RUN chown -R devtron:devtron /usr/share/nginx/html
# Make our shell script executable
RUN chmod +x env.sh
USER devtron
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]