chore: Update Docker configuration and Gitea deployment workflow
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:
2026-01-15 17:01:39 +01:00
parent ab02058c9d
commit 5e544afdae
3 changed files with 15 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ docker-compose*.yml
# Scripts (keep only essential ones) # Scripts (keep only essential ones)
scripts scripts
!scripts/init-db.sql !scripts/init-db.sql
!scripts/start-with-migrate.js
# Misc # Misc
.cache .cache

View File

@@ -158,11 +158,21 @@ jobs:
fi fi
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 # Start new container with updated image
echo "🆕 Starting new dev container..." echo "🆕 Starting new dev container..."
docker run -d \ docker run -d \
--name $CONTAINER_NAME \ --name $CONTAINER_NAME \
--restart unless-stopped \ --restart unless-stopped \
--network proxy \
-p ${HEALTH_PORT}:3000 \ -p ${HEALTH_PORT}:3000 \
-e NODE_ENV=production \ -e NODE_ENV=production \
-e LOG_LEVEL=${LOG_LEVEL:-debug} \ -e LOG_LEVEL=${LOG_LEVEL:-debug} \

View File

@@ -66,7 +66,6 @@ RUN adduser --system --uid 1001 nextjs
# Copy the built application # Copy the built application
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/scripts ./scripts
# Set the correct permission for prerender cache # Set the correct permission for prerender cache
RUN mkdir .next 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
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 # Note: Environment variables should be passed via docker-compose or runtime environment
# DO NOT copy .env files into the image for security reasons # DO NOT copy .env files into the image for security reasons