Add postgres to devcontainer / compose
This commit is contained in:
parent
2d97353649
commit
7c3aac56ec
@ -1,10 +1,13 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://containers.dev/implementors/json_schema/",
|
"$schema": "https://containers.dev/implementors/json_schema/",
|
||||||
"build": {
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
"dockerfile": "Dockerfile"
|
"service": "app",
|
||||||
|
"workspaceFolder": "/workspaces/firehose",
|
||||||
|
"remoteUser": "root",
|
||||||
|
"containerEnv": {
|
||||||
|
"DB_HOST": "db",
|
||||||
|
"HOME": "/home/vscode"
|
||||||
},
|
},
|
||||||
"remoteUser": "vscode",
|
|
||||||
"runArgs": [],
|
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/python:1": {},
|
"ghcr.io/devcontainers/features/python:1": {},
|
||||||
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
|
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
|
||||||
|
|||||||
28
.devcontainer/docker-compose.yml
Normal file
28
.devcontainer/docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
volumes:
|
||||||
|
- ..:/workspaces/firehose:cached
|
||||||
|
command: sleep infinity
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:16
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
@ -4,7 +4,7 @@ import Config
|
|||||||
config :firehose, Firehose.Repo,
|
config :firehose, Firehose.Repo,
|
||||||
username: "postgres",
|
username: "postgres",
|
||||||
password: "postgres",
|
password: "postgres",
|
||||||
hostname: "localhost",
|
hostname: System.get_env("DB_HOST") || "localhost",
|
||||||
database: "firehose_dev",
|
database: "firehose_dev",
|
||||||
stacktrace: true,
|
stacktrace: true,
|
||||||
show_sensitive_data_on_connection_error: true,
|
show_sensitive_data_on_connection_error: true,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import Config
|
|||||||
config :firehose, Firehose.Repo,
|
config :firehose, Firehose.Repo,
|
||||||
username: "postgres",
|
username: "postgres",
|
||||||
password: "postgres",
|
password: "postgres",
|
||||||
hostname: "localhost",
|
hostname: System.get_env("DB_HOST") || "localhost",
|
||||||
database: "firehose_test#{System.get_env("MIX_TEST_PARTITION")}",
|
database: "firehose_test#{System.get_env("MIX_TEST_PARTITION")}",
|
||||||
pool: Ecto.Adapters.SQL.Sandbox,
|
pool: Ecto.Adapters.SQL.Sandbox,
|
||||||
pool_size: System.schedulers_online() * 2
|
pool_size: System.schedulers_online() * 2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user