use custom network for docker run commands

This commit is contained in:
sid palas
2023-02-20 13:33:27 -05:00
parent c954a8205a
commit 7010a748e0
6 changed files with 48 additions and 10 deletions

View File

@ -1,13 +1,29 @@
services:
client-react-vite:
image: client-react-vite
build:
context: ../05-example-web-application/client-react/
dockerfile: ../../06-building-container-images/client-react/Dockerfile.4
init: true
volumes:
- ${PWD}/client-react/vite.config.js:/usr/src/app/vite.config.js
networks:
- frontend
ports:
- 5173:5173
client-react-nginx:
image: client-react-nginx
build:
context: ../05-example-web-application/client-react/
dockerfile: ../../06-building-container-images/client-react/Dockerfile.5
init: true
networks:
- frontend
ports:
- 5174:80
- 80:8080
restart: unless-stopped
api-node:
image: api-node
build:
context: ../05-example-web-application/api-node/
dockerfile: ../../06-building-container-images/api-node/Dockerfile.8
@ -16,10 +32,14 @@ services:
- db
environment:
- DATABASE_URL=postgres://postgres:foobarbaz@db:5432/postgres
networks:
- frontend
- backend
ports:
- 3000:3000
restart: unless-stopped
api-golang:
image: api-golang
build:
context: ../05-example-web-application/api-golang/
dockerfile: ../../06-building-container-images/api-golang/Dockerfile.6
@ -28,6 +48,9 @@ services:
- db
environment:
- DATABASE_URL=postgres://postgres:foobarbaz@db:5432/postgres
networks:
- frontend
- backend
ports:
- 8080:8080
restart: unless-stopped
@ -37,7 +60,12 @@ services:
- pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=foobarbaz
networks:
- backend
ports:
- 5432:5432
volumes:
pgdata:
pgdata:
networks:
frontend:
backend: