From b4e3f5453ebb07a91d99d828075fd0faea364545 Mon Sep 17 00:00:00 2001 From: Ty Eggen Date: Mon, 30 Sep 2024 20:27:28 +0000 Subject: [PATCH] build: updated Dockerfile to use corepack - cleaned up/optimized command execution --- Dockerfile | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 735e195..0ea586d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,27 @@ -FROM node:lts AS build - -WORKDIR /build +FROM node:lts AS base +RUN corepack enable -RUN npm install -g npm +FROM base AS build -COPY package.json . -COPY yarn.lock . +WORKDIR /build -COPY client/ client/ -COPY server/ server/ +COPY package.json yarn.lock /build/ -RUN npx yarn install +COPY client/ /build/client/ +COPY server/ /build/server/ -RUN npx yarn workspace tacos-client run build +RUN yarn install && yarn workspace tacos-client run build -FROM node:lts +FROM base AS prod EXPOSE 3000 + CMD ["npm","start"] -WORKDIR /app -RUN npm install -g npm +WORKDIR /app COPY --from=build /build/server/ /app/ COPY --from=build /build/client/build/ /app/public/ -RUN npx yarn install \ No newline at end of file +RUN yarn install