-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: leverage .env file - prevent user from modifying docker-compose.yml - prevent user from building db url by itself, thanks to dotenv-expand * refactor: expose db port only to other services * refactor: expose db port only to other services --------- Co-authored-by: João Lucas <77590858+dev-stupid-codes@users.noreply.github.com>
- Loading branch information
1 parent
b43e5b2
commit 9031db0
Showing
4 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
version: '3.3' | ||
networks: | ||
yabin-network: | ||
name: yabin-network | ||
ipam: | ||
driver: default | ||
services: | ||
yabin: | ||
container_name: yabin | ||
ports: | ||
- '3000:3000' | ||
- '${PORT:-3000}:${PORT:-3000}' | ||
image: 'yureien/yabin:latest' | ||
environment: | ||
- DATABASE_URL=postgresql://user:pass@db:5432/yabin?schema=public | ||
env_file: .env | ||
depends_on: | ||
- db | ||
networks: | ||
- yabin-network | ||
db: | ||
container_name: yabin-db | ||
restart: always | ||
image: postgres:15-alpine | ||
env_file: .env | ||
expose: | ||
- '5432' | ||
environment: | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: pass | ||
POSTGRES_DB: yabin | ||
POSTGRES_USER: ${DB_USER:-yabin_user} | ||
POSTGRES_PASSWORD: ${DB_USER_PASS:-123} | ||
POSTGRES_DB: ${DB_NAME:-yabin_db} | ||
POSTGRES_HOST_AUTH_METHOD: "trust" | ||
volumes: | ||
- db_data:/var/lib/postgresql/data:Z | ||
restart: always | ||
volumes: | ||
db_data: {} | ||
- ./db-data:/var/lib/postgresql/data | ||
networks: | ||
- yabin-network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters