diff --git a/.cline-context.md b/.cline-context.md index fc2e681..208db3f 100644 --- a/.cline-context.md +++ b/.cline-context.md @@ -22,6 +22,8 @@ - Implemented full-fidelity standard Task Export pair (`/api/export`) supporting RFC 4180 / TickTick-compatible CSV with UTF-8 BOM, and RFC 5545 iCalendar (`.ics` VTODO) format. - 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. + - Migrated repository and full 12-commit history to self-hosted Gitea (`https://git.nrh.kr/Neru_Han/checkflow.git`). + - 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 (`git.nrh.kr`). - Validated that `npm run lint` and `npm run build` execute with 0 errors and 0 warnings. - **Next Steps (Todo):** diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml new file mode 100644 index 0000000..5bb8088 --- /dev/null +++ b/.gitea/workflows/docker-build.yaml @@ -0,0 +1,31 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + - master + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.nrh.kr + username: ${{ gitea.actor }} + password: ${{ secrets.CI_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: git.nrh.kr/${{ gitea.repository }}:latest diff --git a/Dockerfile b/Dockerfile index 9848ade..5ed4559 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,37 @@ FROM node:20-alpine AS base WORKDIR /app +RUN apk add --no-cache libc6-compat +# 1. Install dependencies based on package-lock.json FROM base AS deps COPY package.json package-lock.json ./ RUN npm ci --legacy-peer-deps +# 2. Rebuild the source code and generate Prisma client FROM base AS builder COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npx prisma generate +ENV NEXT_TELEMETRY_DISABLED=1 RUN npm run build +# 3. Production runner FROM base AS runner ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 + RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static -COPY --from=builder /app/public ./public -COPY --from=builder /app/prisma ./prisma -COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma -COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma + +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/static ./.next/static +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 USER nextjs EXPOSE 3000 ENV PORT=3000 ENV HOSTNAME="0.0.0.0" -CMD ["node", "server.js"] \ No newline at end of file +CMD ["node", "server.js"]