From 586bac8018ee84aaea75532a8f5ccb6b0e242455 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:34:11 -0500 Subject: [PATCH] Fix gulp for Admin/Sso --- bitwarden_license/src/Sso/Dockerfile | 22 ++++++++++++++++++++++ src/Admin/Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/bitwarden_license/src/Sso/Dockerfile b/bitwarden_license/src/Sso/Dockerfile index 439ffd4f04..784647dee2 100644 --- a/bitwarden_license/src/Sso/Dockerfile +++ b/bitwarden_license/src/Sso/Dockerfile @@ -5,6 +5,8 @@ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build # Docker buildx supplies the value for this arg ARG TARGETPLATFORM +ENV NODE_VERSION=16.20.2 +ENV NVM_DIR /usr/local/nvm # Determine proper runtime value for .NET # We put the value in a file to be read by later layers. @@ -17,6 +19,24 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ fi \ && echo "RID=$RID" > /tmp/rid.txt +# Add packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Set up Node +RUN mkdir -p $NVM_DIR +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default +ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules +ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH + +# Install gulp +RUN npm install -g gulp + # Copy csproj files as distinct layers WORKDIR /source COPY bitwarden_license/src/Sso/*.csproj ./bitwarden_license/src/Sso/ @@ -41,6 +61,8 @@ COPY .git/. ./.git/ # Build Sso app WORKDIR /source/bitwarden_license/src/Sso +RUN npm install +RUN gulp --gulpfile "gulpfile.js" build RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Sso --no-restore --no-self-contained -r $RID WORKDIR /app diff --git a/src/Admin/Dockerfile b/src/Admin/Dockerfile index 37e523a4fe..20930d774e 100644 --- a/src/Admin/Dockerfile +++ b/src/Admin/Dockerfile @@ -5,6 +5,8 @@ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build # Docker buildx supplies the value for this arg ARG TARGETPLATFORM +ARG NODE_VERSION=16.20.2 +ENV NVM_DIR /usr/local/nvm # Determine proper runtime value for .NET # We put the value in a file to be read by later layers. @@ -17,6 +19,24 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ fi \ && echo "RID=$RID" > /tmp/rid.txt +# Add packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Set up Node +RUN mkdir -p $NVM_DIR +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default +ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules +ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH + +# Install gulp +RUN npm install -g gulp + # Copy csproj files as distinct layers WORKDIR /source COPY src/Admin/*.csproj ./src/Admin/ @@ -54,6 +74,8 @@ COPY .git/. ./.git/ # Build Admin app WORKDIR /source/src/Admin +RUN npm install +RUN gulp --gulpfile "gulpfile.js" build RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Admin --no-restore --no-self-contained -r $RID WORKDIR /app