mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-03 20:12:58 +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:
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Unified entrypoint for Trackeep
|
||||
# Starts both backend and nginx in one container
|
||||
|
||||
set -e
|
||||
|
||||
# Backend configuration
|
||||
export BACKEND_PORT=${BACKEND_PORT:-8080}
|
||||
export DB_HOST=${DB_HOST:-postgres}
|
||||
export DB_PORT=${DB_PORT:-5432}
|
||||
export DB_NAME=${DB_NAME:-trackeep}
|
||||
export DB_USER=${DB_USER:-trackeep}
|
||||
export DB_PASSWORD=${DB_PASSWORD}
|
||||
export DRAGONFLY_ADDR=${DRAGONFLY_ADDR:-dragonfly:6379}
|
||||
export DRAGONFLY_PASSWORD=${DRAGONFLY_PASSWORD}
|
||||
export JWT_SECRET=${JWT_SECRET}
|
||||
export GIN_MODE=${GIN_MODE:-release}
|
||||
|
||||
# Start backend in background
|
||||
cd /app
|
||||
echo "Starting Trackeep backend on port ${BACKEND_PORT}..."
|
||||
./main &
|
||||
|
||||
# Wait for backend to be ready
|
||||
echo "Waiting for backend to be ready..."
|
||||
for i in $(seq 1 30); do
|
||||
if wget --no-verbose --tries=1 --spider http://localhost:${BACKEND_PORT}/health 2>/dev/null; then
|
||||
echo "Backend is ready!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Update nginx config to proxy to localhost backend
|
||||
sed -i "s|http://trackeep-backend:8080/|http://localhost:${BACKEND_PORT}/|g" /etc/nginx/nginx.conf
|
||||
|
||||
# Start nginx
|
||||
echo "Starting nginx..."
|
||||
nginx -g "daemon off;"
|
||||
Reference in New Issue
Block a user