diff --git a/.github/workflows/docker-backend.yml b/.github/workflows/docker-backend.yml index 96b4a85..8b4759b 100644 --- a/.github/workflows/docker-backend.yml +++ b/.github/workflows/docker-backend.yml @@ -28,6 +28,18 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 11 + + - name: Set up Node.js 24 + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: 'pnpm' + cache-dependency-path: backend/pnpm-lock.yaml + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -58,7 +70,7 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=backend + cache-to: type=gha,mode=max,scope=backend build-args: | DATABASE_URL=postgresql://localhost:5432/dummy diff --git a/.github/workflows/docker-frontend.yml b/.github/workflows/docker-frontend.yml index d5246a0..8152b98 100644 --- a/.github/workflows/docker-frontend.yml +++ b/.github/workflows/docker-frontend.yml @@ -28,6 +28,26 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 11 + + - name: Set up Node.js 24 + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: 'pnpm' + cache-dependency-path: frontend/pnpm-lock.yaml + + - name: Cache Next.js build + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/frontend/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('frontend/pnpm-lock.yaml') }}-${{ hashFiles('frontend/src/**') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('frontend/pnpm-lock.yaml') }}- + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 @@ -58,8 +78,8 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=frontend + cache-to: type=gha,mode=max,scope=frontend build-args: | NEXT_PUBLIC_URL=https://rito.blue DATABASE_URL=postgresql://localhost:5432/dummy diff --git a/backend/Dockerfile b/backend/Dockerfile index 078ccaa..1975270 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,5 @@ # ---------- Build Stage ---------- -FROM node:22-alpine AS build +FROM node:24-alpine AS build RUN apk update && apk upgrade --no-cache # 作業ディレクトリ @@ -25,7 +25,7 @@ ENV DATABASE_URL=$DATABASE_URL RUN pnpm run build && pnpm prune --prod # ---------- Production Stage ---------- -FROM node:22-alpine AS production +FROM node:24-alpine AS production ENV NODE_ENV=production RUN apk update && apk upgrade --no-cache diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9be8903..84f0128 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker.io/docker/dockerfile:1 -FROM node:22-alpine AS base +FROM node:24-alpine AS base # Install dependencies only when needed FROM base AS deps