forked from shopizer-ecommerce/shopizer-shop-reactjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 796 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
36
37
38
39
40
41
42
43
# build env
FROM node:13.12.0-alpine as builder
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package*.json ./
COPY .env ./
COPY env.sh ./
COPY conf ./
#remove internal .env file
RUN npm ci --silent
#must match package.json react-scripts
COPY . .
RUN npm run build
# production env
FROM nginx:stable-alpine
# Nginx config
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
RUN ls -al
COPY --from=builder /app/build /usr/share/nginx/html
WORKDIR /usr/share/nginx/html
COPY ./env.sh .
COPY .env .
RUN ls -al /usr/share/nginx/html
# Add bash
RUN apk add --no-cache bash
# Make our shell script executable
RUN chmod +x env.sh
EXPOSE 80
#CMD ["nginx", "-g", "daemon off;"]
# Start Nginx server
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]