Skip to content

Commit

Permalink
introduced docker-compose overrides for networking
Browse files Browse the repository at this point in the history
  • Loading branch information
parseccentric committed Mar 29, 2022
1 parent 9a8f612 commit 6d68fc0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 23 deletions.
22 changes: 22 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This Docker (manual) override file opens ports and disables traefik.

# examples of using this file:
# DEVELOPMENT ONLY. PROCEED WITH CAUTION, BECAUSE IT WILL OPEN PORTS:
# $ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build frontend
# $ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build backend
# $ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build

version: '3.3'
services:

backend:
labels:
- "traefik.enable=false"
ports:
- 4040:4040

frontend:
labels:
- "traefik.enable=false"
ports:
- 8080:80
35 changes: 35 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This Docker (auto) override file creates top-level networks and connects to them in the service level.

# examples of using this file:
# $ docker-compose up --build
# $ docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build

version: '3.3'
services:

backend:
labels:
- "traefik.frontend.rule=Host:api.komodo-dev.library.illinois.edu"
- "traefik.backend=komodo-portal-backend"
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.port=4040"
networks:
- proxy
- komodo_internal

frontend:
labels:
- "traefik.frontend.rule=Host:komodo-dev.library.illinois.edu"
- "traefik.backend=komodo-portal-frontend"
- "traefik.enable=true"
- "traefik.docker.network=proxy"
networks:
- proxy
- komodo_internal

networks:
proxy:
external: true
komodo_internal:
external: true
31 changes: 8 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
# This Docker compose file serves as a base. To use it with networks, please see...
# - docker-compose.override.yml
# - docker-compose.dev.yml

# examples of using this file:
# $ docker-compose up --build
# $ docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build

version: '3.3'
services:

backend:
build: ./backend
container_name: komodo-portal-backend
restart: always
labels:
- "traefik.frontend.rule=Host:api.komodo-dev.library.illinois.edu"
- "traefik.backend=komodo-portal-backend"
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.port=4040"
networks:
- proxy
- komodo_internal

frontend:
build: ./frontend
container_name: komodo-portal-frontend
restart: always
labels:
- "traefik.frontend.rule=Host:komodo-dev.library.illinois.edu"
- "traefik.backend=komodo-portal-frontend"
- "traefik.enable=true"
- "traefik.docker.network=proxy"
environment:
- VUE_APP_API_BASE_URL
networks:
- proxy
- komodo_internal

networks:
proxy:
external: true
komodo_internal:
external: true

0 comments on commit 6d68fc0

Please sign in to comment.