Browse Source

Add docker volumes to server and web

main
Haris Razis 4 years ago
parent
commit
a403f8da77
  1. 2
      .idea/runConfigurations/docker_compose.xml
  2. 6
      docker-compose.yml
  3. 6
      server/Dockerfile
  4. 1858
      server/package-lock.json
  5. 2
      server/package.json
  6. 11
      web/Dockerfile
  7. 16
      web/prod.Dockerfile

2
.idea/runConfigurations/Server_compose.xml → .idea/runConfigurations/docker_compose.xml

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Server_compose" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker"> <configuration default="false" name="docker compose" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml"> <deployment type="docker-compose.yml">
<settings> <settings>
<option name="removeVolumesOnComposeDown" value="true" /> <option name="removeVolumesOnComposeDown" value="true" />

6
docker-compose.yml

@ -38,6 +38,9 @@ services:
window: 120s window: 120s
ports: ports:
- "8000:8000" - "8000:8000"
volumes:
- ./server:/usr/src/app/server
- /usr/src/app/server/node_modules
networks: networks:
- backend - backend
- frontend - frontend
@ -56,6 +59,9 @@ services:
window: 120s window: 120s
ports: ports:
- "8080:8080" - "8080:8080"
volumes:
- ./web:/usr/src/app/web
- /usr/src/app/web/node_modules
networks: networks:
- frontend - frontend
depends_on: depends_on:

6
server/Dockerfile

@ -1,11 +1,11 @@
FROM node:latest FROM node:latest
WORKDIR /usr/src/app WORKDIR /usr/src/app/server
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
COPY . .
EXPOSE 8000 EXPOSE 8000
CMD [ "npm", "start" ]
CMD [ "npm", "run", "dev" ]

1858
server/package-lock.json

File diff suppressed because it is too large

2
server/package.json

@ -14,6 +14,7 @@
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"connect-history-api-fallback": "^1.6.0",
"cookie-session": "^1.4.0", "cookie-session": "^1.4.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"debug": "^2.6.9", "debug": "^2.6.9",
@ -21,6 +22,7 @@
"express-session": "^1.17.1", "express-session": "^1.17.1",
"express-validator": "^6.8.0", "express-validator": "^6.8.0",
"mongoose": "^5.11.8", "mongoose": "^5.11.8",
"nodemon": "^2.0.6",
"passport": "^0.4.1", "passport": "^0.4.1",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"redis": "^3.0.2", "redis": "^3.0.2",

11
web/Dockerfile

@ -1,16 +1,11 @@
FROM node:latest FROM node:latest
RUN npm install -g http-server WORKDIR /usr/src/app/web
WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
COPY . .
RUN npm run build
EXPOSE 8080 EXPOSE 8080
CMD [ "http-server", "dist" ]
CMD ["npm", "run", "serve"]

16
web/prod.Dockerfile

@ -0,0 +1,16 @@
FROM node:latest
RUN npm install -g http-server
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8080
CMD [ "http-server", "dist" ]
Loading…
Cancel
Save