-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (35 loc) · 1.36 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
# build environment
FROM node:16-alpine as build
WORKDIR /app
ARG REACT_APP_PUBLIC_URL
ARG REACT_APP_API_HOST
ARG REACT_APP_API_PORT
ARG REACT_APP_AUTH_URL
ARG REACT_APP_IDENTITY_CLIENT_ID
ARG REACT_APP_REDIRECT_URL
ARG REACT_APP_SILENT_REDIRECT_URL
ARG REACT_APP_LOGOFF_REDIRECT_URL
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json /app/package.json
RUN npm install -g [email protected]
RUN npm config set legacy-peer-deps true
RUN npm install
RUN npm install [email protected] -g
COPY . /app
ENV REACT_APP_PUBLIC_URL $REACT_APP_PUBLIC_URL
ENV REACT_APP_API_PORT $REACT_APP_API_PORT
ENV REACT_APP_API_HOST $REACT_APP_API_HOST
ENV REACT_APP_AUTH_URL $REACT_APP_AUTH_URL
ENV REACT_APP_IDENTITY_CLIENT_ID $REACT_APP_IDENTITY_CLIENT_ID
ENV REACT_APP_REDIRECT_URL $REACT_APP_REDIRECT_URL
ENV REACT_APP_SILENT_REDIRECT_URL $REACT_APP_SILENT_REDIRECT_URL
ENV REACT_APP_LOGOFF_REDIRECT_URL $REACT_APP_LOGOFF_REDIRECT_URL
RUN npm run build
# production environment
FROM nginx
COPY --from=build /app/build /var/www
RUN mkdir -p /etc/nginx/ssl/private/ && mkdir -p /etc/nginx/ssl/cert/
RUN openssl req -x509 -new -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout /etc/nginx/ssl/private/cert.key -out /etc/nginx/ssl/cert/cert.crt -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,IP:10.21.0.126"
COPY nginx.conf /etc/nginx/nginx.conf
#EXPOSE 3000
ENTRYPOINT ["nginx","-g","daemon off;"]