chore: Update Docker configuration and Gitea deployment workflow
All checks were successful
Dev Deployment (Zero Downtime) / deploy-dev (push) Successful in 15m36s
All checks were successful
Dev Deployment (Zero Downtime) / deploy-dev (push) Successful in 15m36s
- Added a new script for database migration to the Docker image. - Adjusted Dockerfile to create the scripts directory and copy the migration script with the correct permissions. - Enhanced the Gitea deployment workflow to ensure the proxy network exists before starting the container.
This commit is contained in:
@@ -57,6 +57,7 @@ docker-compose*.yml
|
||||
# Scripts (keep only essential ones)
|
||||
scripts
|
||||
!scripts/init-db.sql
|
||||
!scripts/start-with-migrate.js
|
||||
|
||||
# Misc
|
||||
.cache
|
||||
|
||||
@@ -158,11 +158,21 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ensure proxy network exists
|
||||
echo "🌐 Checking for proxy network..."
|
||||
if ! docker network inspect proxy >/dev/null 2>&1; then
|
||||
echo "⚠️ Proxy network not found, creating it..."
|
||||
docker network create proxy 2>/dev/null || echo "Network might already exist or creation failed"
|
||||
else
|
||||
echo "✅ Proxy network exists"
|
||||
fi
|
||||
|
||||
# Start new container with updated image
|
||||
echo "🆕 Starting new dev container..."
|
||||
docker run -d \
|
||||
--name $CONTAINER_NAME \
|
||||
--restart unless-stopped \
|
||||
--network proxy \
|
||||
-p ${HEALTH_PORT}:3000 \
|
||||
-e NODE_ENV=production \
|
||||
-e LOG_LEVEL=${LOG_LEVEL:-debug} \
|
||||
|
||||
@@ -66,7 +66,6 @@ RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# Copy the built application
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/scripts ./scripts
|
||||
|
||||
# Set the correct permission for prerender cache
|
||||
RUN mkdir .next
|
||||
@@ -86,6 +85,10 @@ COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
|
||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||
|
||||
# Create scripts directory and copy start script AFTER standalone to ensure it's not overwritten
|
||||
RUN mkdir -p scripts && chown nextjs:nodejs scripts
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/scripts/start-with-migrate.js ./scripts/start-with-migrate.js
|
||||
|
||||
# Note: Environment variables should be passed via docker-compose or runtime environment
|
||||
# DO NOT copy .env files into the image for security reasons
|
||||
|
||||
|
||||
Reference in New Issue
Block a user