initial devcontainer setup

This commit is contained in:
Jeff Clement 2025-07-18 23:12:35 +00:00
commit b9b7aa6a08
Signed by: jeff
GPG key ID: 3BCB43A3F0E1D7DA
14 changed files with 411 additions and 0 deletions

View file

@ -0,0 +1,63 @@
version: '3'
# NOTE on `network_mode`
# All of the containers are bound together and share the same network context as the DB container.
# This means that each service needs to be listening to a unique port since they are all effectively
# mount to the same interface. i.e. Execute can connect to postgres on 127.0.0.1:5432 even though
# they are separate containers. Note that if, for some reason, Postgres fails to start, the other
# containers are going to have all manner of mysterious network connectivity issues.
services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- ..:/workspace:cached
depends_on:
- postgres
environment:
# Configure MISE to use DEV and DEVCONTAINER environments
MISE_ENV: dev,devcontainer
# Setup postgres environment variables
PGUSER: postgres
PGDATABASE: app
PGPASSWORD: postgres
PGHOST: postgres
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
network_mode: service:postgres
caddy:
image: caddy:latest
restart: unless-stopped
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./offline.html:/data/offline.html
network_mode: service:postgres
pgweb:
image: sosedoff/pgweb
restart: unless-stopped
environment:
- PGWEB_DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/app?sslmode=disable
- PGWEB_LOCK_SESSION=true # disable connect/disconnect buttons since they aren't useful here
depends_on:
- postgres # my database container is called postgres, not db
network_mode: service:postgres
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_DB: app
POSTGRES_PASSWORD: postgres
healthcheck:
test: pg_isready -U postgres -h 127.0.0.1
interval: 5s