mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
create production docker image
This commit is contained in:
36
Dockerfile
Normal file
36
Dockerfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
## build image
|
||||||
|
FROM node:13.12.0-buster-slim as build
|
||||||
|
|
||||||
|
## set working directory
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
## add `/usr/src/app/node_modules/.bin` to $PATH
|
||||||
|
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||||
|
|
||||||
|
## install and cache app dependencies
|
||||||
|
COPY package.json /usr/src/app/package.json
|
||||||
|
|
||||||
|
## install app dependencies
|
||||||
|
RUN npm install --silent
|
||||||
|
|
||||||
|
## copy files
|
||||||
|
COPY . /usr/src/app
|
||||||
|
|
||||||
|
## build production app
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
## production environment
|
||||||
|
FROM nginx:1.17.9-alpine
|
||||||
|
|
||||||
|
## copy build artifacts to nginx
|
||||||
|
COPY --from=build /usr/src/app/build /usr/share/nginx/html
|
||||||
|
|
||||||
|
## copy custom nginx config
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
COPY nginx/nginx.conf /etc/nginx/conf.d
|
||||||
|
|
||||||
|
## export port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
## run nginx server
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
@ -10,7 +10,7 @@ ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
|||||||
## install and cache app dependencies
|
## install and cache app dependencies
|
||||||
COPY package.json /usr/src/app/package.json
|
COPY package.json /usr/src/app/package.json
|
||||||
|
|
||||||
# install app dependencies
|
## install app dependencies
|
||||||
RUN npm install --silent
|
RUN npm install --silent
|
||||||
|
|
||||||
## start app
|
## start app
|
||||||
|
|||||||
@ -6,7 +6,7 @@ services:
|
|||||||
tty: true
|
tty: true
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile-dev
|
||||||
volumes:
|
volumes:
|
||||||
- '.:/usr/src/app'
|
- '.:/usr/src/app'
|
||||||
- '/usr/src/app/node_modules'
|
- '/usr/src/app/node_modules'
|
||||||
|
|||||||
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
reactive-resume:
|
||||||
|
container_name: reactive-resume
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
expose:
|
||||||
|
- '80'
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
17
nginx/nginx.conf
Normal file
17
nginx/nginx.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user