This commit is contained in:
Claude Agent
2026-03-04 09:45:18 +00:00
parent 8a7956252c
commit 1fdac3fb57
6 changed files with 70 additions and 3 deletions

View File

@@ -11,6 +11,8 @@ COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
COPY backend/ . COPY backend/ .
COPY --from=frontend-builder /app/frontend/dist /app/dist COPY --from=frontend-builder /app/frontend/dist /app/dist
RUN chmod +x entrypoint.sh
RUN mkdir -p uploads RUN mkdir -p uploads
EXPOSE 8000 EXPOSE 8000
ENTRYPOINT ["./entrypoint.sh"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -66,10 +66,53 @@ Frontend will be available at: http://localhost:5173
## Demo Accounts ## Demo Accounts
After seeding the database: After seeding the database (runs automatically on container start):
- **Admin:** admin@example.com / adminpassword | Email | Password | Role |
- **User:** user@example.com / userpassword |-------|----------|------|
| admin@example.com | adminpassword | Superadmin |
| manager@example.com | managerpassword | Manager |
| user@example.com | userpassword | User |
## Docker Compose (local)
```bash
# Create .env from template
cp backend/.env.example backend/.env
# Edit .env with your values
# Start all services
docker compose up --build
```
Frontend: http://localhost
Backend API: http://localhost:8000/docs
## Deploy (Dokploy)
```
Dokploy UI → New Service → Docker Compose → Git: space-booking repo
```
### Environment Variables (Dokploy → Environment tab)
| Variable | Required | Example |
|----------|----------|---------|
| `SECRET_KEY` | **Yes** | `python -c "import secrets; print(secrets.token_hex(32))"` |
| `FRONTEND_URL` | **Yes** | `https://space.roa.romfast.ro` |
| `SMTP_ENABLED` | No | `true` |
| `SMTP_HOST` | No* | `smtp.example.com` |
| `SMTP_PORT` | No* | `587` |
| `SMTP_USER` | No* | `user@example.com` |
| `SMTP_PASSWORD` | No* | `secret` |
| `SMTP_FROM_ADDRESS` | No* | `rezervari@romfast.ro` |
*Required only if `SMTP_ENABLED=true`
### Auto-seed
`entrypoint.sh` runs `seed_db.py` automatically on every container start.
The script is idempotent — skips if data already exists.
## Development Commands ## Development Commands

View File

@@ -25,3 +25,13 @@ FRONTEND_URL=http://localhost:5173
GOOGLE_CLIENT_ID=your_google_client_id_here GOOGLE_CLIENT_ID=your_google_client_id_here
GOOGLE_CLIENT_SECRET=your_google_client_secret_here GOOGLE_CLIENT_SECRET=your_google_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost:8000/api/integrations/google/callback GOOGLE_REDIRECT_URI=http://localhost:8000/api/integrations/google/callback
# === PRODUCTION (Dokploy) ===
# SECRET_KEY=<python -c "import secrets; print(secrets.token_hex(32))">
# FRONTEND_URL=https://space.roa.romfast.ro
# SMTP_ENABLED=true
# SMTP_HOST=smtp.example.com
# SMTP_PORT=587
# SMTP_USER=user@example.com
# SMTP_PASSWORD=parola
# SMTP_FROM_ADDRESS=rezervari@romfast.ro

View File

@@ -7,8 +7,11 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . . COPY . .
RUN chmod +x entrypoint.sh
RUN mkdir -p uploads RUN mkdir -p uploads
EXPOSE 8000 EXPOSE 8000
ENTRYPOINT ["./entrypoint.sh"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

6
backend/entrypoint.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -e
echo "[entrypoint] Running database seed..."
python seed_db.py
echo "[entrypoint] Starting application..."
exec "$@"

View File

@@ -11,6 +11,9 @@ services:
- SMTP_HOST=${SMTP_HOST:-localhost} - SMTP_HOST=${SMTP_HOST:-localhost}
- SMTP_PORT=${SMTP_PORT:-1025} - SMTP_PORT=${SMTP_PORT:-1025}
- SMTP_ENABLED=${SMTP_ENABLED:-false} - SMTP_ENABLED=${SMTP_ENABLED:-false}
- SMTP_USER=${SMTP_USER:-}
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
- SMTP_FROM_ADDRESS=${SMTP_FROM_ADDRESS:-noreply@space-booking.local}
volumes: volumes:
- backend_data:/data - backend_data:/data
- uploads_data:/app/uploads - uploads_data:/app/uploads