mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-12 01:39:58 +02:00
Fixes "The server does not support SSL connections" by disabling SSL in DATABASE_URL for local Docker deployments and in server/db.ts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 4b008663-bd72-492b-b0b6-fa252367e730 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/4b008663-bd72-492b-b0b6-fa252367e730/QW0MKzv
91 lines
2.6 KiB
Docker
91 lines
2.6 KiB
Docker
# Dockerfile Simple - Sans Migration
|
|
FROM node:20-alpine AS builder
|
|
|
|
RUN apk add --no-cache python3 make g++ git
|
|
WORKDIR /build
|
|
COPY package*.json ./
|
|
RUN npm ci --include=dev --prefer-offline
|
|
COPY . .
|
|
RUN npm run build && ls -la dist/ && test -f dist/index.js
|
|
|
|
# Production Simple
|
|
FROM node:20-alpine AS production
|
|
|
|
RUN apk add --no-cache dumb-init postgresql-client wget curl bash
|
|
RUN addgroup -g 1001 -S nodejs && adduser -S regisflow -u 1001 -G nodejs
|
|
|
|
WORKDIR /app
|
|
RUN mkdir -p /app/backups /app/logs /app/data
|
|
|
|
COPY --from=builder --chown=regisflow:nodejs /build/package*.json ./
|
|
COPY --from=builder --chown=regisflow:nodejs /build/dist ./dist
|
|
COPY --from=builder --chown=regisflow:nodejs /build/shared ./shared
|
|
COPY --from=builder --chown=regisflow:nodejs /build/drizzle.config.ts ./
|
|
|
|
# Installer TOUTES les dépendances pour avoir accès à drizzle-kit
|
|
RUN npm ci --include=dev --prefer-offline
|
|
|
|
COPY --from=builder --chown=regisflow:nodejs /build/dist/public ./public
|
|
RUN npm cache clean --force
|
|
|
|
# Script d'entrée simplifié - SKIP migration si elle échoue
|
|
RUN cat > /app/start.sh << 'EOF'
|
|
#!/bin/bash
|
|
set -e
|
|
echo "🚀 RegisFlow Production Starting..."
|
|
|
|
# Check database
|
|
if [ -z "$DATABASE_URL" ]; then
|
|
echo "❌ DATABASE_URL not set"
|
|
exit 1
|
|
fi
|
|
|
|
DB_HOST=$(echo $DATABASE_URL | sed -n 's|.*@\([^:/]*\).*|\1|p')
|
|
DB_PORT=$(echo $DATABASE_URL | sed -n 's|.*:\([0-9]*\)/.*|\1|p')
|
|
DB_USER=$(echo $DATABASE_URL | sed -n 's|.*://\([^:]*\):.*|\1|p')
|
|
|
|
echo "⏳ Waiting for database $DB_HOST:${DB_PORT:-5432}..."
|
|
timeout=60
|
|
while ! pg_isready -h "$DB_HOST" -p "${DB_PORT:-5432}" -U "$DB_USER" -q && [ $timeout -gt 0 ]; do
|
|
sleep 2
|
|
timeout=$((timeout-2))
|
|
done
|
|
|
|
if [ $timeout -le 0 ]; then
|
|
echo "❌ Database timeout"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Database ready"
|
|
mkdir -p /app/logs /app/backups
|
|
|
|
# Try migration but don't fail if it doesn't work
|
|
echo "🔄 Attempting database migration..."
|
|
if npm run db:push 2>/dev/null; then
|
|
echo "✅ Migration completed"
|
|
else
|
|
echo "⚠️ Migration skipped - will auto-create on first connection"
|
|
fi
|
|
|
|
echo "🌟 Starting RegisFlow application..."
|
|
# Assurer que sslmode=disable est présent
|
|
if [[ "$DATABASE_URL" != *"sslmode=disable"* ]]; then
|
|
export DATABASE_URL="${DATABASE_URL}?sslmode=disable"
|
|
fi
|
|
echo " Database URL configured with SSL disabled"
|
|
exec npm start
|
|
EOF
|
|
|
|
RUN chmod +x /app/start.sh && chown regisflow:nodejs /app/start.sh
|
|
|
|
USER regisflow
|
|
EXPOSE 5000
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=5000
|
|
ENV TZ=Europe/Paris
|
|
|
|
HEALTHCHECK --interval=30s --timeout=15s --start-period=90s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:5000/health || exit 1
|
|
|
|
ENTRYPOINT ["dumb-init", "--", "/app/start.sh"] |