mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-04 04:22:57 +00:00
refactor: unify docker deployment and restructure frontend architecture
This commit implements a unified Docker deployment strategy, moving from separate frontend and backend images to a single, multi-stage build image containing both services. It also introduces a major reorganization of the frontend directory structure and simplifies the environment configuration. Key changes: - **Deployment**: Added a multi-stage `Dockerfile` and `docker-entrypoint.sh` to package the Go backend and Nginx-served frontend into a single container. - **CI/CD**: Updated GitHub Actions workflows (`ci-cd.yml`, `release.yml`) to build and push the new unified image instead of separate ones. - **Frontend Refactor**: Reorganized `frontend/src/pages` into a domain-driven directory structure (e.g., `auth/`, `admin/`, `content/`, `communication/`, `productivity/`, `settings/`, `misc/`). - **Configuration**: Simplified `.env.example` and updated `docker-compose.yml` to reflect the unified service model and single host port. - **Cleanup**: Removed deprecated `docker-compose.demo.yml`, `docker-compose.prod.yml`, and various unused frontend components and services. - **Backend**: Refactored configuration loading to use exported `GetDurationEnv` for better consistency.
This commit is contained in:
+13
-47
@@ -1,14 +1,16 @@
|
||||
icon: https://github.com/Dvorinka/Trackeep/raw/main/trackeepfavi_bg.png
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_NAME:-trackeep}
|
||||
POSTGRES_USER: ${DB_USER:-trackeep}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
ports:
|
||||
- "${DB_HOST_PORT:-5433}:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgres/data
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-trackeep} -d ${DB_NAME:-trackeep}"]
|
||||
@@ -19,7 +21,6 @@ services:
|
||||
|
||||
dragonfly:
|
||||
image: ghcr.io/dragonflydb/dragonfly:latest
|
||||
container_name: dragonfly
|
||||
ports:
|
||||
- "${DRAGONFLY_HOST_PORT:-6380}:6379"
|
||||
volumes:
|
||||
@@ -35,64 +36,29 @@ services:
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
trackeep-backend:
|
||||
trackeep:
|
||||
build:
|
||||
context: ./backend
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "${BACKEND_HOST_PORT:-9000}:${BACKEND_PORT:-8080}"
|
||||
- "${HOST_PORT:-8080}:8080"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- APP_VERSION=${APP_VERSION:-1.0.0}
|
||||
- BACKEND_PORT=${BACKEND_PORT:-8080}
|
||||
- FRONTEND_PORT=${FRONTEND_PORT:-3000}
|
||||
- DRAGONFLY_ADDR=${DRAGONFLY_ADDR:-dragonfly:6379}
|
||||
- DRAGONFLY_PASSWORD=${DRAGONFLY_PASSWORD}
|
||||
- VITE_DEMO_MODE=${VITE_DEMO_MODE:-false}
|
||||
- BACKEND_PORT=8080
|
||||
- DB_HOST=postgres
|
||||
- DB_PORT=5432
|
||||
- DRAGONFLY_ADDR=dragonfly:6379
|
||||
- GIN_MODE=release
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./uploads:/app/uploads
|
||||
- /var/run/docker.sock:/var/run/docker.sock # Docker socket for updates
|
||||
- ./data:/data
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
dragonfly:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:${BACKEND_PORT:-8080}/health || wget --no-verbose --tries=1 --spider http://localhost:${BACKEND_PORT:-8080}/live"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
trackeep-frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./frontend/Dockerfile
|
||||
args:
|
||||
- VITE_DEMO_MODE=${VITE_DEMO_MODE:-false}
|
||||
- VITE_API_URL=${VITE_API_URL:-http://localhost:${BACKEND_HOST_PORT:-9000}}
|
||||
ports:
|
||||
- "${FRONTEND_HOST_PORT:-3900}:${FRONTEND_PORT:-3000}"
|
||||
environment:
|
||||
- VITE_APP_VERSION=${APP_VERSION:-1.0.0}
|
||||
- VITE_DEMO_MODE=${VITE_DEMO_MODE:-false}
|
||||
- VITE_API_URL=${VITE_API_URL:-http://localhost:${BACKEND_HOST_PORT:-9000}}
|
||||
- FRONTEND_PORT=${FRONTEND_PORT:-3000}
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock # Docker socket for updates
|
||||
depends_on:
|
||||
trackeep-backend:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pgrep nginx > /dev/null || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user