Skip to content

Commit

Permalink
Move external ports to env file (#1575)
Browse files Browse the repository at this point in the history
When running both bornhack-website and bma in the same docker compose setup, the external host ports for postgres would conflict.
This MR moves the definitions to an environment file, which is created on init, if it does not already exist.
  • Loading branch information
blackthornedk authored Jun 2, 2024
1 parent 68dd077 commit 620a5bd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ environment_settings.py
elm-stuff/
.coverage
media
docker/.env
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ build_docker_image:
${DOCKER_COMPOSE} build app

copy_env_file:
cp src/bornhack/environment_settings.py.dist.dev src/bornhack/environment_settings.py
test -f src/bornhack/environment_settings.py || cp src/bornhack/environment_settings.py.dist.dev src/bornhack/environment_settings.py
test -f docker/.env || cp docker/.env.dev docker/.env

update_submodules:
git submodule update --init --recursive
2 changes: 2 additions & 0 deletions docker/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
db_port=5432
web_port=8000
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: ../
dockerfile: docker/Dockerfile
ports:
- "8000:8000"
- "${web_port}:8000"
tty: true
stdin_open: true
command: python src/manage.py runserver 0.0.0.0:8000
Expand Down Expand Up @@ -43,4 +43,4 @@ services:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
- ${db_port}:5432

0 comments on commit 620a5bd

Please sign in to comment.