-
-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from MichelDiz/master
add support for Docker
- Loading branch information
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM node:14-alpine AS builder | ||
ENV NODE_ENV production | ||
|
||
WORKDIR /app | ||
|
||
COPY client/package.json . | ||
COPY client/yarn.lock . | ||
RUN yarn install --production | ||
|
||
COPY client . | ||
|
||
RUN npm run build | ||
|
||
|
||
FROM nginx:1.21.0-alpine as production | ||
ENV NODE_ENV production | ||
|
||
COPY --from=builder /app/build /usr/share/nginx/html | ||
|
||
COPY ./client/nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html/; | ||
include /etc/nginx/mime.types; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '3.1' | ||
services: | ||
client: | ||
container_name: client | ||
image: client-prod | ||
build: | ||
dockerfile: ./client/Dockerfile | ||
target: production | ||
ports: | ||
- '80:80' | ||
depends_on: | ||
- server | ||
- mongo | ||
links: | ||
- server | ||
- mongo | ||
server: | ||
container_name: server | ||
image: server-prod | ||
build: | ||
dockerfile: ./server/Dockerfile | ||
ports: | ||
- '5000:5000' | ||
depends_on: | ||
- mongo | ||
links: | ||
- mongo | ||
mongo: | ||
image: mongo | ||
container_name: MONGODB | ||
ports: | ||
- '27017' |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:14-alpine AS builder | ||
ENV NODE_ENV production | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
COPY server/package.json . | ||
RUN npm install | ||
COPY server/ . | ||
|
||
RUN npm install && npm install nodemon --save-dev | ||
|
||
EXPOSE 5000 | ||
CMD ["yarn", "start-prod"] |