-
Notifications
You must be signed in to change notification settings - Fork 35
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 #54 from dehydr8/docker-compose
Rework docker setup to use security best practices
- Loading branch information
Showing
65 changed files
with
898 additions
and
269 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules/ | ||
deploy/ | ||
build/ | ||
db/ | ||
db/ | ||
**/*.test.js | ||
.heroku/ |
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 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
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,19 @@ | ||
version: '3' | ||
|
||
services: | ||
client: | ||
build: | ||
context: . | ||
dockerfile: docker/client.dockerfile | ||
container_name: threats-client | ||
restart: unless-stopped | ||
ports: | ||
- "8080:8080" | ||
|
||
server: | ||
build: | ||
context: . | ||
dockerfile: docker/server.dockerfile | ||
container_name: threats-server | ||
restart: unless-stopped | ||
network_mode: service:client |
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,13 @@ | ||
FROM node:15.14.0-alpine3.13 AS builder | ||
WORKDIR /usr/src/app | ||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
COPY ./public ./public | ||
COPY ./src ./src | ||
RUN npm ci | ||
RUN npm run build | ||
|
||
FROM nginxinc/nginx-unprivileged:1.18-alpine | ||
COPY docker/files/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=builder /usr/src/app/build /usr/share/nginx/html/ | ||
EXPOSE 8080 |
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,23 @@ | ||
server { | ||
listen 8080; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri /index.html; | ||
} | ||
|
||
location /api/ { | ||
proxy_pass http://localhost:8001/; | ||
} | ||
|
||
location /socket.io/ { | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_http_version 1.1; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
proxy_pass http://localhost:8000/socket.io/; | ||
} | ||
} |
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,18 @@ | ||
FROM node:15.14.0-alpine3.13 AS builder | ||
WORKDIR /usr/src/app | ||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
RUN npm ci --only=production | ||
|
||
FROM node:15.14.0-alpine3.13 | ||
RUN apk add dumb-init | ||
WORKDIR /usr/src/app | ||
RUN chown node:node /usr/src/app | ||
USER node | ||
ENV NODE_ENV production | ||
COPY --chown=node:node --from=builder /usr/src/app/node_modules /usr/src/app/node_modules | ||
COPY --chown=node:node ./src/server /usr/src/app/src/server | ||
COPY --chown=node:node ./src/game /usr/src/app/src/game | ||
COPY --chown=node:node ./src/utils /usr/src/app/src/utils | ||
CMD [ "dumb-init", "node", "-r", "esm", "/usr/src/app/src/server/server.js" ] | ||
|
Oops, something went wrong.