Skip to content

Instantly share code, notes, and snippets.

@omer-os
Last active March 24, 2026 19:56
Show Gist options
  • Select an option

  • Save omer-os/a5e78469400dc78987a74ca10abacfe2 to your computer and use it in GitHub Desktop.

Select an option

Save omer-os/a5e78469400dc78987a74ca10abacfe2 to your computer and use it in GitHub Desktop.
docker compose file with bun backend and postgresql db
DATABASE_URL=postgresql://omar:121212@localhost:5432/db
POSTGRES_USER=omar
POSTGRES_PASSWORD=121212
POSTGRES_DB=db
volumes:
pg_data:
services:
backend:
build: .
container_name: bun_backend
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
container_name: postgresql
ports:
- "5432:5432"
env_file: .env
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U omar"]
interval: 5s
timeout: 3s
retries: 5
FROM oven/bun:1
WORKDIR /app
COPY package.json .
COPY bun.lock .
RUN bun install
COPY index.ts .
CMD ["bun", "dev"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment