load each environment variable automatically from the env file

This commit is contained in:
2025-03-27 08:26:44 -07:00
parent 25f9dd62b1
commit 829b3f4ffd

View File

@@ -1,18 +1,29 @@
# Note that .env file will automatically populate
# variables in this file.
# If these variables are also set on the host system,
# those will be used over the .env file.
# See https://vsupalov.com/docker-arg-env-variable-guide/
x-common-environment: &common-server-environment
APNS_IS_PRODUCTION: ${APNS_IS_PRODUCTION}
APNS_BUNDLE_ID: ${APNS_BUNDLE_ID}
APNS_TEAM_ID: ${APNS_TEAM_ID}
APNS_KEY_ID: ${APNS_KEY_ID}
APNS_PRIVATE_KEY: ${APNS_PRIVATE_KEY}
services: services:
dev: dev:
build: . build: .
command: npm run start:dev command: npm run start:dev
ports: ports:
- "4000:4000" - "4000:4000"
env_file: .env
depends_on: depends_on:
- redis - redis
environment:
<<: *common-server-environment
volumes: volumes:
- .:/usr/src/app - .:/usr/src/app
# Note that neither app-integration-test or test modes require env variables,
# need to find a way to pass variables without .env if this changes
app-integration-test: app-integration-test:
build: . build: .
command: npm run start:dev integration-testing command: npm run start:dev integration-testing
@@ -20,6 +31,9 @@ services:
- "4000:4000" - "4000:4000"
depends_on: depends_on:
- redis - redis
environment:
<<: *common-server-environment
volumes: volumes:
- .:/usr/src/app - .:/usr/src/app
@@ -28,6 +42,9 @@ services:
command: npm run test command: npm run test
depends_on: depends_on:
- redis - redis
environment:
<<: *common-server-environment
volumes: volumes:
- .:/usr/src/app - .:/usr/src/app
redis: redis: