-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15fb00e
commit ba07109
Showing
6 changed files
with
50 additions
and
145 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
#Base Image | ||
# Base Image | ||
From node:12.18.1 | ||
|
||
#Seeting up env as production | ||
# Seeting up env as production | ||
ENV NODE_ENV=production | ||
|
||
#Making /app dir as working dir | ||
#Getting System Ready to install dependencies | ||
RUN apt-get clean \ | ||
&& apt-get -y update | ||
|
||
# Installing nginx | ||
RUN apt-get -y install nginx \ | ||
&& apt-get -y install python3-dev \ | ||
&& apt-get -y install build-essential | ||
|
||
# Creating symbolic link for access and error log from nginx | ||
RUN ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log | ||
|
||
|
||
# Making /app dir as working dir | ||
WORKDIR /app | ||
|
||
#Adding complete files and dirs in app dir in container | ||
# Adding complete files and dirs in app dir in container | ||
ADD . /app/ | ||
|
||
#Installing dependencies | ||
COPY nginx.default /etc/nginx/sites-available/default | ||
|
||
# Installing dependencies | ||
RUN npm install --production | ||
RUN npm i -g pm2 | ||
|
||
#Starting Server | ||
CMD [ "node", "src/index.js" ] | ||
# Starting Server | ||
CMD ["sh", "-c", "service nginx start ; pm2-runtime src/index.js -i 0"] | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
#Base Image | ||
From node:12.18.1 | ||
###### BUILD ENVIRONMENT ###### | ||
|
||
#Making /app dir as working dir | ||
# Base Image | ||
FROM node:12.18.1 as build | ||
|
||
# Moving into working directory | ||
WORKDIR /app | ||
|
||
#Adding complete files and dirs in app dir in container | ||
# Adding all files and dirs to /app inside container | ||
ADD . /app/ | ||
|
||
#Installing dependencies | ||
RUN npm install | ||
# Installing dependencies | ||
RUN npm install | ||
|
||
# Creating Production build for react-app | ||
RUN npm run build | ||
|
||
# In this dockerfile using the concept of docker multistage build | ||
|
||
###### PRODUCTION ENVIRONMENT ###### | ||
|
||
# Base Image for prod env | ||
FROM nginx:stable-alpine | ||
|
||
# Adding the build files from previous container to nginx/html | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
|
||
# Exposing port 80 to listen http requests | ||
EXPOSE 80 | ||
|
||
#Starting Server | ||
CMD [ "yarn", "start" ] | ||
# Command to run | ||
CMD ["nginx", "-g", "daemon off;"] |
This file was deleted.
Oops, something went wrong.