1.8 KiB
1.8 KiB
Docker Setup Guide
This guide describes how to deploy the application using Docker and Docker Compose.
Prerequisites
- Docker (20.10+)
- Docker Compose (v2.0+)
Environment Variables
Create a .env file in the root directory. The following variables are supported (with their default values shown):
| Variable | Description | Default |
|---|---|---|
DB_USER |
PostgreSQL username | postgres |
DB_PASSWORD |
PostgreSQL password | postgres |
DB_NAME |
PostgreSQL database name | hotdesking |
DB_PORT_EXTERNAL |
External port for PostgreSQL | 5433 |
API_PORT_EXTERNAL |
External port for the API | 3000 |
WEB_PORT_EXTERNAL |
External port for the Web app | 5173 |
JWT_SECRET |
Secret key for JWT signing | super-secret-change-me |
WEB_ORIGIN |
The origin of the web app (required by SvelteKit) | http://localhost:5173 |
VITE_API_BASE_URL |
The URL of the API (for the web app) | http://localhost:3000 |
Deployment Steps
-
Build and start the containers:
docker-compose up -d --build -
Run Database Migrations: Since the API uses Prisma, you need to run migrations to set up the database schema:
docker exec -it hotdesking_api npx prisma migrate deploy -
(Optional) Seed the Database: If you have a seed script defined in
apps/api/prisma/seed.ts:docker exec -it hotdesking_api npx prisma db seed -
Access the Applications:
- Web App: http://localhost:5173
- API: http://localhost:3000
- pgAdmin: http://localhost:5051 (Login:
admin@local.dev/admin)
Development with Docker
To watch logs:
docker-compose logs -f
To stop the applications:
docker-compose down