-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (32 loc) · 981 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
44
45
46
47
48
# PRODUCTION
# base image
FROM node:12.18.0-alpine3.9 as build
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# This is to install all the dependencies
COPY package.json ./
#COPY package-lock.json ./
# install dependencies
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
RUN npm install
RUN npm install [email protected] -g
# copy the rest of the files
COPY . ./
# build
RUN npm run build
########################
# PRODUCTION ENVIRONMENT
# this image comes with nginx
FROM nginx:stable-alpine
# lets copy static react files
COPY --from=build /app/build /usr/share/nginx/html
# delete default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# my nginx config
COPY react-nginx.template /etc/nginx/conf.d
COPY docker-entrypoint-prod.sh /
ENV REACT_APP_API_URL https://chotuve-appserver-staging.herokuapp.com
ENV REACT_APP_USING_FAKE_API ''
ENTRYPOINT ["sh", "/docker-entrypoint-prod.sh"]