From 1aee2e24ae38f945a2bfa888ee1b76c200391da2 Mon Sep 17 00:00:00 2001 From: Nexmoe <16796652+nexmoe@users.noreply.github.com> Date: Thu, 5 Dec 2024 00:05:15 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E7=A7=BB=E9=99=A4=20Dockerfile=20?= =?UTF-8?q?=E5=92=8C=20.dockerignore=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除了 .dockerignore 文件,清除了不需要的文件和目录 - 删除了 Dockerfile 文件,移除了容器化相关的所有配置 --- .dockerignore | 6 ------ Dockerfile | 52 --------------------------------------------------- 2 files changed, 58 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 6ef9371..0000000 --- a/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -npm-debug* -.nuxt -dist -tests -.output diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 115ebea..0000000 --- a/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -# Use a smaller base image -ARG NODE_VERSION=node:20-alpine - -# Stage 1: Build dependencies -FROM $NODE_VERSION AS dependency-base - -# Create app directory -WORKDIR /app - -# Install pnpm -RUN npm install -g pnpm - -# Copy the package files -COPY package.json pnpm-lock.yaml .npmrc ./ - -# Install dependencies using pnpm -RUN pnpm install --frozen-lockfile - -# Stage 2: Build the application -FROM dependency-base AS production-base - -# Copy the source code -COPY . . - -RUN mkdir -p /app/.output - -# Build the application with verbose logging -RUN set -x && \ - pnpm run build && \ - ls -la /app/.output || exit 1 - -# Stage 3: Production image -FROM $NODE_VERSION AS production - -# Copy built assets from previous stage -COPY --from=production-base /app/.output /app/.output -COPY --from=production-base /app/package.json /app -COPY --from=production-base /app/prisma /app/prisma - -# Define environment variables -ENV NUXT_HOST=0.0.0.0 \ - NUXT_APP_VERSION=latest \ - DATABASE_URL=file:./db.sqlite \ - NODE_ENV=production - -# Set the working directory -WORKDIR /app - -EXPOSE 3000 - -# Start the app -CMD ["npm", "run", "start"]