From 3767861fe481240ef3d27c03e285a8ab1a851f2e Mon Sep 17 00:00:00 2001 From: yun Date: Wed, 22 Nov 2023 11:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddocker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 24 ++++++++---------------- docker-compose.yml | 2 +- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9db114a..f9cba20b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,11 @@ -FROM node:18-alpine AS base -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" -RUN corepack enable +FROM debian:11 COPY . /app WORKDIR /app - -FROM base AS prod-deps -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile - -FROM base AS build -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile -RUN pnpm run build - -FROM base -COPY --from=prod-deps /app/node_modules /app/node_modules -COPY --from=build /app/dist /app/dist -EXPOSE 3000 +RUN apt-get update +RUN apt-get install -y wget curl make sudo unzip +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - +RUN apt-get install -y nodejs +RUN npm i -g pnpm +RUN pnpm install +EXPOSE 9527 CMD [ "pnpm", "dev" ] diff --git a/docker-compose.yml b/docker-compose.yml index 8fd70984..8392aeb8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: environment: - TZ=Asia/Shanghai ports: - - "3000:3000" + - "9527:9527" # if you want to persist # volumes: # - ./app:/app