From 8d8a4fb99d06562595c7d3726cfa35eab6794e70 Mon Sep 17 00:00:00 2001 From: Alan Morel Date: Wed, 8 Nov 2023 17:42:22 -0500 Subject: [PATCH] refactor: overhaul Dockerfile and docker-compose.yml --- Dockerfile | 13 +++++++++---- docker-compose.yml | 4 +--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0096a8..110abbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ FROM node:20.1.0-alpine AS base -RUN apk add --update --no-cache openssl1.1-compat +WORKDIR /app -RUN npm install -g pnpm +ENV NODE_ENV production -WORKDIR /app +RUN npm install -g pnpm@8.9.0 + +FROM base AS deps COPY package.json pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile --prod +FROM base AS app + COPY . . +COPY --from=deps /app/node_modules ./node_modules -ENV NODE_ENV production +RUN pnpm ts:check CMD ["pnpm", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a7d93cf..c974f81 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,9 +8,7 @@ services: build: context: . dockerfile: Dockerfile - target: base - environment: - DOCKER: "true" + target: app volumes: - "./logs:/app/logs" networks: