Skip to content

Commit

Permalink
Refactor Compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
joonashak committed Jun 5, 2024
1 parent 698fa26 commit 11b3a23
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 32 deletions.
23 changes: 23 additions & 0 deletions compose.base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Common bases for dev containers.
# Not to be used directly, see compose.yaml.
services:
web-base:
build: ./web/
env_file:
- .env
volumes:
- ./web/src:/usr/src/app/src
- ./web/public:/usr/src/app/public

server-base:
build:
context: ./server/
dockerfile: Dockerfile.dev
target: dev
env_file:
- .env
environment:
- NODE_ENV=development
- PORT=3001
volumes:
- ./server/src:/usr/src/app/src
10 changes: 10 additions & 0 deletions compose.services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Service containers for the development environment.
services:
nv-mock:
image: mockoon/cli
container_name: nv-mock
ports:
- 4002:4002
volumes:
- ./nv-mock:/data
command: "--port 4002 --data /data/nv-mock.json"
48 changes: 16 additions & 32 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,44 @@
# Bootstraps the local development environment. Not for production use.
# Bootstraps the local development environment.
services:
web-base:
build: ./web/
env_file:
- .env
volumes:
- ./web/src:/usr/src/app/src
- ./web/public:/usr/src/app/public
web:
extends: web-base
extends:
file: compose.base.yaml
service: web-base
container_name: keijo-web
environment:
- VITE_API_URL=http://localhost:3001/graphql
ports:
- 3000:5173

web-test:
extends: web-base
extends:
file: compose.base.yaml
service: web-base
container_name: keijo-web-test
environment:
- VITE_API_URL=http://localhost:4001/graphql
ports:
- 4000:5173

server-base:
build:
context: ./server/
dockerfile: Dockerfile.dev
target: dev
env_file:
- .env
environment:
- NODE_ENV=development
- PORT=3001
volumes:
- ./server/src:/usr/src/app/src

server:
extends: server-base
extends:
file: compose.base.yaml
service: server-base
container_name: keijo-server
ports:
- 3001:3001

server-test:
extends: server-base
extends:
file: compose.base.yaml
service: server-base
container_name: keijo-server-test
environment:
- NETVISOR_API_URL=http://nv-mock:4002
ports:
- 4001:3001

nv-mock:
image: mockoon/cli
container_name: nv-mock
ports:
- 4002:4002
volumes:
- ./nv-mock:/data
command: "--port 4002 --data /data/nv-mock.json"
extends:
file: compose.services.yaml
service: nv-mock

0 comments on commit 11b3a23

Please sign in to comment.