From d16141141624124409b0bd759325703f0dc15d8d Mon Sep 17 00:00:00 2001 From: Julien Recurt Date: Tue, 21 May 2024 11:27:02 +0200 Subject: [PATCH] Updating Dockerfile for multistage build based on feedbacks --- .dockerignore | 5 +++++ Dockerfile | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 118a677a3..fcac172a2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,8 +11,13 @@ # Ignore git and cache folders .git +.gitignore .cache +# Ignore build folders +node_modules +dist + # Ignore default volumes created by running docker compose up ontime-db ontime-styles diff --git a/Dockerfile b/Dockerfile index 82861a678..35ecc88b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM node:18.18-alpine as builder -ENV NODE_ENV=docker -ENV ONTIME_DATA=/external/ -WORKDIR /app/ -RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - -COPY . /app/ -RUN PNPM_HOME="/root/.local/share/pnpm" PATH="${PATH}:/root/.local/share/pnpm" pnpm i -run PNPM_HOME="/root/.local/share/pnpm" PATH="${PATH}:/root/.local/share/pnpm" pnpm run build:localdocker +FROM node:18.18-alpine AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable + +FROM base AS builder +COPY . /app +WORKDIR /app +RUN pnpm install --frozen-lockfile \ + && pnpm turbo build:docker FROM node:18.18-alpine