showing results for - "react with docker with caprover"
Erik
06 Jun 2017
1Dockerfile
2# build environment
3FROM node:9.6.1 as builder
4RUN mkdir /usr/src/app
5WORKDIR /usr/src/app
6ENV PATH /usr/src/app/node_modules/.bin:$PATH
7COPY . /usr/src/app
8RUN npm install
9RUN npm run build
10
11# production environment
12FROM nginx:1.13.9-alpine
13RUN rm -rf /etc/nginx/conf.d
14RUN mkdir -p /etc/nginx/conf.d
15COPY ./default.conf /etc/nginx/conf.d/
16COPY --from=builder /usr/src/app/build /usr/share/nginx/html
17EXPOSE 80
18CMD ["nginx", "-g", "daemon off;"]
19
20default.conf 
21server {
22  listen 80;
23  location / {
24    root   /usr/share/nginx/html;
25    index  index.html index.htm;
26    try_files $uri $uri/ /index.html;
27  }
28  error_page   500 502 503 504  /50x.html;
29  location = /50x.html {
30    root   /usr/share/nginx/html;
31  }
32}
33
34
35captain-definition
36
37{
38    "schemaVersion": 2,
39    "dockerfilePath": "./DockerFile"
40}