Fix environment variables in deployment scripts
- Export all environment variables before deployment to ensure they're available to child processes - Add logging to show which variables are configured (without revealing secrets) - This fixes docker-compose warnings about missing environment variables - Ensures both docker run and docker-compose scenarios work correctly Updated scripts: - scripts/gitea-deploy.sh - scripts/gitea-deploy-simple.sh
This commit is contained in:
@@ -88,6 +88,30 @@ success "✅ Docker image built successfully"
|
||||
# Step 3: Deployment
|
||||
log "🚀 Step 3: Deploying application..."
|
||||
|
||||
# Export environment variables for docker-compose compatibility
|
||||
log "📝 Exporting environment variables..."
|
||||
export NODE_ENV=${NODE_ENV:-production}
|
||||
export NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL:-https://dk0.dev}
|
||||
export MY_EMAIL=${MY_EMAIL:-contact@dk0.dev}
|
||||
export MY_INFO_EMAIL=${MY_INFO_EMAIL:-info@dk0.dev}
|
||||
export MY_PASSWORD="${MY_PASSWORD}"
|
||||
export MY_INFO_PASSWORD="${MY_INFO_PASSWORD}"
|
||||
export ADMIN_BASIC_AUTH="${ADMIN_BASIC_AUTH}"
|
||||
export LOG_LEVEL=${LOG_LEVEL:-info}
|
||||
export PORT=${PORT:-3000}
|
||||
|
||||
# Log which variables are set (without revealing secrets)
|
||||
log "Environment variables configured:"
|
||||
log " - NODE_ENV: ${NODE_ENV}"
|
||||
log " - NEXT_PUBLIC_BASE_URL: ${NEXT_PUBLIC_BASE_URL}"
|
||||
log " - MY_EMAIL: ${MY_EMAIL}"
|
||||
log " - MY_INFO_EMAIL: ${MY_INFO_EMAIL}"
|
||||
log " - MY_PASSWORD: [SET]"
|
||||
log " - MY_INFO_PASSWORD: [SET]"
|
||||
log " - ADMIN_BASIC_AUTH: [SET]"
|
||||
log " - LOG_LEVEL: ${LOG_LEVEL}"
|
||||
log " - PORT: ${PORT}"
|
||||
|
||||
# Check if container is running
|
||||
if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null)" = "true" ]; then
|
||||
log "📦 Stopping existing container..."
|
||||
|
||||
Reference in New Issue
Block a user