Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ports exposed in docker compose configurable #2858

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- db
- redis-cache
ports:
- "8000:8000"
- "${EXPOSE_TECKEN_PORT:-8000}:8000"
links:
- db
- fakesentry
Expand Down Expand Up @@ -62,7 +62,7 @@ services:
extends:
service: base
ports:
- "8000:8000"
- "${EXPOSE_TECKEN_PORT:-8000}:8000"
links:
- db
- redis-cache
Expand Down Expand Up @@ -108,15 +108,15 @@ services:
environment:
- LOCALSTACK_HOST=localstack
ports:
- "4566:4566"
- "${EXPOSE_LOCALSTACK_PORT:-4566}:4566"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you want to set the environment variables? If you set them in .env, they will only be used by the Makefile, and not if VS Code brings the container up. If you set them in your .bashrc, then all the variable names should contain TECKEN, so they don't conflict with variable names for other services.

Copy link
Member Author

@relud relud Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker compose automatically picks up variables from .env https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file

I made sure it works by exiting vscode, running docker compose -f docker-compose.yml -f .devcontainer/docker-compose.yml down, opening vscode, waiting for the devcontainer to finish starting, and finally checking the exposed ports via docker compose -f docker-compose.yml -f .devcontainer/docker-compose.yml ps. the overrides that i had set in .env were used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice! I didn't know. We should make use of that for the build arguments. They are currently passed in explicitly from the Makefile, but we should add them to docker-compose.yml instead.


# https://github.com/willkg/kent
fakesentry:
build:
context: docker/images/fakesentry
image: local/tecken_fakesentry
ports:
- "8090:8090"
- "${EXPOSE_SENTRY_PORT:-8090}:8090"
command: run --host 0.0.0.0 --port 8090

# https://hub.docker.com/r/mozilla/oidc-testprovider
Expand All @@ -125,14 +125,10 @@ services:
context: docker/images/oidcprovider
image: local/tecken_oidcprovider
ports:
- "8080:8080"
- "${EXPOSE_OIDC_PORT:-8080}:8080"

# https://hub.docker.com/r/hopsoft/graphite-statsd/
statsd:
image: hopsoft/graphite-statsd:latest
ports:
- "8081:80"
- "2003-2004:2003-2004"
- "2023-2024:2023-2024"
- "8125:8125/udp"
- "8126:8126"
- "${EXPOSE_GRAFANA_PORT:-8081}:80"