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}
1# pull official base image
2FROM node:13.12.0-alpine
3
4# set working directory
5WORKDIR /app
6
7# add `/app/node_modules/.bin` to $PATH
8ENV PATH /app/node_modules/.bin:$PATH
9
10# install app dependencies
11COPY package.json ./
12COPY package-lock.json ./
13RUN npm install --silent
14RUN npm install react-scripts@3.4.1 -g --silent
15
16# add app
17COPY . ./
18
19# start app
20CMD ["npm", "start"]
21
1# Stage 1 - Building image
2FROM node:8.7.0-alpine as node
3
4WORKDIR /usr/src/app
5
6COPY package*.json ./
7
8RUN npm install
9
10COPY . .
11
12RUN npm run build
13
14# Stage 2 - Running image
15FROM bitnami/nginx:1.14.2
16
17COPY --from=node /usr/src/app/build /var/www/my-app
18COPY ./nginx.conf /opt/bitnami/nginx/conf/nginx.conf
19
20
1version: '3'
2
3services:
4 backend:
5 env_file:
6 "./backend/backend.env"
7 build:
8 context: ./backend
9 dockerfile: ./Dockerfile
10 image: "dmurphy1217/twitter-sentiment-backend"
11 ports:
12 - "5000:5000"
13 frontend:
14 build:
15 context: ./client
16 dockerfile: ./Dockerfile
17 image: "dmurphy1217/twitter-sentiment-frontend"
18 ports:
19 - "3000:3000"
20 links:
21 - "backend:be"