feat: optimize docker build pipeline with dockerignore, automated entrypoint migrations, and configurable compose image
Build and Push Docker Image / build-and-push (push) Failing after 1m1s

This commit is contained in:
2026-08-21 16:59:24 +09:00
parent 364ff4c4e8
commit 9beaebb5d8
6 changed files with 69 additions and 17 deletions
+4 -1
View File
@@ -24,7 +24,10 @@
- Added Export modal in Sidebar user popover menu supporting format selection, target list filtering, completed tasks inclusion toggle, and seamless Demo mode client-side Blob generation. - Added Export modal in Sidebar user popover menu supporting format selection, target list filtering, completed tasks inclusion toggle, and seamless Demo mode client-side Blob generation.
- Added localized i18n strings for Export across English, Korean, and Japanese. - Added localized i18n strings for Export across English, Korean, and Japanese.
- Migrated repository and commit history to self-hosted Gitea remote origin. - Migrated repository and commit history to self-hosted Gitea remote origin.
- Configured production multi-stage `Dockerfile` and automated Gitea Actions CI workflow (`.gitea/workflows/docker-build.yaml`) for building & pushing container images to Gitea Container Registry. - Configured production multi-stage `Dockerfile` with standalone Next.js runner, Prisma CLI migrations support, and automated `docker-entrypoint.sh` startup script.
- Added `.dockerignore` for minimal context transfer and fast build times.
- Refined `docker-compose.yml` and `.env.example` to support prebuilt registry images (`CHECKFLOW_IMAGE`) and automated database migrations.
- Automated Gitea Actions CI workflow (`.gitea/workflows/docker-build.yaml`) for building & pushing container images to Gitea Container Registry.
- Validated that `npm run lint` and `npm run build` execute with 0 errors and 0 warnings. - Validated that `npm run lint` and `npm run build` execute with 0 errors and 0 warnings.
- **Next Steps (Todo):** - **Next Steps (Todo):**
+35
View File
@@ -0,0 +1,35 @@
# Dependencies & Build Output
node_modules
.next
out
# Git & Version Control
.git
.gitignore
# Environment & Secret Files
.env
.env*.local
*.pem
# Log Files
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# AI & Editor Contexts
.clinecontext
.cline-context.md
.clinerules
src/.clinerules
CLAUDE.md
# Documentation & CI Workflows (not needed inside container image)
.gitea
docker-compose*.yml
# Local Dev DBs
prisma/dev
prisma/*.db
prisma/*.db-journal
+4 -1
View File
@@ -8,4 +8,7 @@ NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=change-this-to-a-random-string NEXTAUTH_SECRET=change-this-to-a-random-string
# Port to expose (default 3000) # Port to expose (default 3000)
PORT=3000 PORT=3000
# Container Registry Image (Optional, default: checkflow:latest)
# CHECKFLOW_IMAGE=gitea.example.com/username/checkflow:latest
+7
View File
@@ -22,16 +22,23 @@ ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
# Copy runtime assets and standalone build
COPY --from=builder --chown=nextjs:nodejs /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/.prisma ./node_modules/.prisma COPY --from=builder --chown=nextjs:nodejs /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/@prisma ./node_modules/@prisma COPY --from=builder --chown=nextjs:nodejs /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/prisma ./node_modules/prisma
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
COPY --chown=nextjs:nodejs docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
USER nextjs USER nextjs
EXPOSE 3000 EXPOSE 3000
ENV PORT=3000 ENV PORT=3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["node", "server.js"] CMD ["node", "server.js"]
+7 -15
View File
@@ -17,24 +17,16 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
migrate:
build: .
container_name: checkflow-migrate
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgresql://checkflow:${POSTGRES_PASSWORD:-changeme}@postgres:5432/checkflow
command: npx prisma migrate deploy
restart: "no"
app: app:
build: . image: ${CHECKFLOW_IMAGE:-checkflow:latest}
build:
context: .
dockerfile: Dockerfile
container_name: checkflow-app container_name: checkflow-app
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
migrate: postgres:
condition: service_completed_successfully condition: service_healthy
ports: ports:
- "${PORT:-3000}:3000" - "${PORT:-3000}:3000"
environment: environment:
@@ -46,4 +38,4 @@ services:
- ./prisma:/app/prisma - ./prisma:/app/prisma
volumes: volumes:
postgres_data: postgres_data:
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
set -e
# Run Prisma database migrations if DATABASE_URL is set and not explicitly skipped
if [ -n "$DATABASE_URL" ] && [ "$SKIP_DB_MIGRATE" != "true" ]; then
echo "[CheckFlow] Checking and applying database migrations..."
if [ -f "./node_modules/prisma/build/index.js" ]; then
node ./node_modules/prisma/build/index.js migrate deploy --schema=./prisma/schema.prisma || echo "[CheckFlow] Warning: Prisma migration step skipped or encountered non-fatal error."
fi
fi
exec "$@"