58 lines
876 B
Markdown
58 lines
876 B
Markdown
# Docker Guide
|
|
|
|
## Docker Compose
|
|
|
|
```bash
|
|
# Start services
|
|
docker-compose up -d
|
|
|
|
# Setup database
|
|
docker-compose exec app bun run db:push
|
|
|
|
# View logs
|
|
docker-compose logs -f app
|
|
|
|
# Stop services
|
|
docker-compose down
|
|
```
|
|
|
|
Visit `http://localhost:3000`
|
|
|
|
## Docker Build
|
|
|
|
```bash
|
|
# Build image
|
|
docker build -t wishlist-app .
|
|
|
|
# Run container
|
|
docker run -d \
|
|
-p 3000:3000 \
|
|
-e DATABASE_URL="postgresql://user:pass@host:5432/db" \
|
|
--name wishlist-app \
|
|
wishlist-app
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
Required:
|
|
- `DATABASE_URL` - PostgreSQL connection string
|
|
- `NODE_ENV` - Set to `production`
|
|
- `PORT` - Default `3000`
|
|
|
|
## Database Setup
|
|
|
|
```bash
|
|
# docker-compose
|
|
docker-compose exec app bun run db:push
|
|
|
|
# Standalone container
|
|
docker exec -it wishlist-app bun run db:push
|
|
```
|
|
|
|
## Migrations
|
|
|
|
Production migrations:
|
|
```bash
|
|
docker exec -it wishlist-app bun run db:migrate
|
|
```
|