Skip to content

Commit

Permalink
feat: Docker Compose Profiles (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
akashvarun10 committed Aug 14, 2024
1 parent 78005b3 commit 5fd8f4a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
32 changes: 28 additions & 4 deletions docker-compose.yaml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
db:
image: postgres:15.1-alpine
Expand All @@ -12,9 +10,11 @@ services:
POSTGRES_PASSWORD: ${NUXT_DB_PASSWORD:-postgrespw}
POSTGRES_DB: ${NUXT_DB_DATABASE:-vidur}
ports:
- "5432:5432"
- "${NUXT_DB_PORT:-5432}:5432"
volumes:
- vidur_data:/var/lib/postgresql/data
profiles:
- dev

app:
build:
Expand All @@ -24,7 +24,7 @@ services:
env_file:
- .env
environment:
PORT: 3001
PORT: ${PORT:-3001}
NUXT_DB_HOST: db
NUXT_DB_PORT: ${NUXT_DB_PORT:-5432}
NUXT_DB_USER: ${NUXT_DB_USER:-postgres}
Expand All @@ -39,6 +39,30 @@ services:
- .:/app
- /app/node_modules
- static_data:/tmp/vidur-jobs-dev
profiles:
- dev

app-prod:
build:
context: .
dockerfile: infra/Dockerfile.prod
container_name: vidur_app_prod
env_file:
- .env
environment:
PORT: ${PORT:-3001}
NUXT_DB_HOST: ${NUXT_DB_HOST:-db}
NUXT_DB_PORT: ${NUXT_DB_PORT:-5432}
NUXT_DB_USER: ${NUXT_DB_USER:-postgres}
NUXT_DB_PASSWORD: ${NUXT_DB_PASSWORD:-postgrespw}
NUXT_DB_DATABASE: ${NUXT_DB_DATABASE:-vidur}
NUXT_BYPASS_ADMIN: ${NUXT_BYPASS_ADMIN:-true}
ports:
- "3001:3001"
volumes:
- static_data:/tmp/vidur-jobs-dev
profiles:
- prod

volumes:
vidur_data:
Expand Down
8 changes: 5 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ yarn migration:apply # Create database schema.
yarn dev # Finally, start the dev server.
```

Or simply by using Docker Compose.
```sh
docker compose up
**Or simply use Docker**
```bash
docker compose --profile dev up
```

This command starts the `db` and `app` services using the `dev` profile. It runs PostgreSQL as `database` and the app as `vidur_app`.

## Contributing
There are several ways to start contributing to Vidur. See [contribution guide](./CONTRIBUTING.md) to get started.

Expand Down

0 comments on commit 5fd8f4a

Please sign in to comment.