-
-
Save omer-os/a5e78469400dc78987a74ca10abacfe2 to your computer and use it in GitHub Desktop.
docker compose file with bun backend and postgresql db
This file contains hidden or 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
| DATABASE_URL=postgresql://omar:121212@localhost:5432/db | |
| POSTGRES_USER=omar | |
| POSTGRES_PASSWORD=121212 | |
| POSTGRES_DB=db |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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