Skip to content

Commit

Permalink
Containerize production version
Browse files Browse the repository at this point in the history
  • Loading branch information
juffalow committed Nov 23, 2020
1 parent 94d5615 commit 7bcef9d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
.git
README.md
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:14.15.1-alpine as build

RUN mkdir /home/node/react-relay-example/ && chown -R node:node /home/node/react-relay-example
WORKDIR /home/node/react-relay-example
COPY --chown=node:node . .
RUN yarn install --frozen-lockfile && yarn build

FROM nginx:stable-alpine

COPY --from=build /home/node/react-relay-example/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
17 changes: 17 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}

}

0 comments on commit 7bcef9d

Please sign in to comment.