From fa8791746f22207469ec6dc5f636b531d6a21a3e Mon Sep 17 00:00:00 2001 From: tnagorra Date: Tue, 3 Dec 2024 15:27:50 +0545 Subject: [PATCH 1/2] Add patches while installing packages --- nginx-serve/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-serve/Dockerfile b/nginx-serve/Dockerfile index a4cefb75a..357ddfa17 100644 --- a/nginx-serve/Dockerfile +++ b/nginx-serve/Dockerfile @@ -17,7 +17,7 @@ RUN git config --global --add safe.directory /code FROM runtime AS nginx-build # NOTE: --parents is not yet available in stable syntax, using docker/dockerfile:1-labs -COPY --parents package.json pnpm-lock.yaml ./**/package.json /code/ +COPY --parents package.json pnpm-lock.yaml ./**/package.json patches/ /code/ RUN pnpm install From 5d7605232e5299f66b7269deceb9961e63df0b9e Mon Sep 17 00:00:00 2001 From: tnagorra Date: Tue, 3 Dec 2024 15:47:42 +0545 Subject: [PATCH 2/2] Fix issue with pnpm workspace --- nginx-serve/Dockerfile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/nginx-serve/Dockerfile b/nginx-serve/Dockerfile index 357ddfa17..dca4134cb 100644 --- a/nginx-serve/Dockerfile +++ b/nginx-serve/Dockerfile @@ -1,6 +1,7 @@ # syntax=docker/dockerfile:1-labs -FROM node:18-bullseye AS runtime +# -------------------------- Dev --------------------------------------- +FROM node:18-bullseye AS dev RUN apt-get update -y \ && apt-get install -y --no-install-recommends \ @@ -9,18 +10,24 @@ RUN apt-get update -y \ RUN npm install -g pnpm +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable + WORKDIR /code RUN git config --global --add safe.directory /code -# ------------------------------------------------------------------------------------ -FROM runtime AS nginx-build +# -------------------------- Nginx - Builder -------------------------------- +FROM dev AS nginx-build # NOTE: --parents is not yet available in stable syntax, using docker/dockerfile:1-labs -COPY --parents package.json pnpm-lock.yaml ./**/package.json patches/ /code/ +COPY --parents package.json pnpm-lock.yaml pnpm-workspace.yaml ./**/package.json patches/ /code/ RUN pnpm install +COPY . /code/ + # Dynamic configs. Can be changed with containers. (Placeholder values) ENV APP_TITLE=APP_TITLE_PLACEHOLDER ENV APP_ENVIRONMENT=APP_ENVIRONMENT_PLACEHOLDER @@ -38,11 +45,9 @@ ENV APP_SENTRY_REPLAYS_SESSION_SAMPLE_RATE=${APP_SENTRY_REPLAYS_SESSION_SAMPLE_R ARG APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE= ENV APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE=${APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE} -COPY . /code/ - RUN pnpm build -# ------------------------------------------------------------------------------------ +# --------------------------------------------------------------------------- FROM nginx:1 AS nginx-serve LABEL maintainer="IFRC"