diff --git a/bitwarden_license/src/Scim/Dockerfile b/bitwarden_license/src/Scim/Dockerfile index a6823a46a3..51ed4458e2 100644 --- a/bitwarden_license/src/Scim/Dockerfile +++ b/bitwarden_license/src/Scim/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/bitwarden_license/src/Scim RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Scim --no-restore --no-self-contained -r $RID diff --git a/bitwarden_license/src/Sso/Dockerfile b/bitwarden_license/src/Sso/Dockerfile index e53fdeb1af..2541bc8878 100644 --- a/bitwarden_license/src/Sso/Dockerfile +++ b/bitwarden_license/src/Sso/Dockerfile @@ -56,7 +56,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/bitwarden_license/src/Sso RUN npm ci RUN npm run build diff --git a/src/Admin/Dockerfile b/src/Admin/Dockerfile index f9eeb172c9..6da566ce41 100644 --- a/src/Admin/Dockerfile +++ b/src/Admin/Dockerfile @@ -5,8 +5,6 @@ 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. @@ -25,6 +23,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Set up Node +ARG NODE_VERSION=16.20.2 +ENV NVM_DIR /usr/local/nvm 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 \ @@ -51,6 +51,7 @@ COPY Directory.Build.props . # Restore project dependencies and tools WORKDIR /source/src/Admin +RUN npm ci RUN . /tmp/rid.txt && dotnet restore -r $RID # Copy required project files @@ -69,9 +70,8 @@ COPY bitwarden_license/src/Commercial.Core/. ./bitwarden_license/src/Commercial. COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/. ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Admin -RUN npm ci RUN npm run build RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Admin --no-restore --no-self-contained -r $RID @@ -88,17 +88,18 @@ ENV ASPNETCORE_ENVIRONMENT=Production ENV ASPNETCORE_URLS http://+:5000 EXPOSE 5000 -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gosu \ curl \ && rm -rf /var/lib/apt/lists/* +# Copy image entrypoint +COPY src/Admin/entrypoint.sh / +RUN chmod +x /entrypoint.sh + # Copy app from the build stage WORKDIR /app COPY --from=build /app/Admin ./ -COPY src/Admin/entrypoint.sh / -RUN chmod +x /entrypoint.sh HEALTHCHECK CMD curl -f http://localhost:5000 || exit 1 diff --git a/src/Api/Dockerfile b/src/Api/Dockerfile index 728d1accd2..f065fb4d7c 100644 --- a/src/Api/Dockerfile +++ b/src/Api/Dockerfile @@ -43,7 +43,7 @@ COPY bitwarden_license/src/Commercial.Core/. ./bitwarden_license/src/Commercial. COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/. ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Api RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Api --no-restore --no-self-contained -r $RID diff --git a/src/Billing/Dockerfile b/src/Billing/Dockerfile index 9c17890bd8..66302ee0b0 100644 --- a/src/Billing/Dockerfile +++ b/src/Billing/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Billing RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Billing --no-restore --no-self-contained -r $RID diff --git a/src/Events/Dockerfile b/src/Events/Dockerfile index 88a0b06530..473111a13f 100644 --- a/src/Events/Dockerfile +++ b/src/Events/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Events RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Events --no-restore --no-self-contained -r $RID diff --git a/src/EventsProcessor/Dockerfile b/src/EventsProcessor/Dockerfile index 28e1d72357..16c9e8e234 100644 --- a/src/EventsProcessor/Dockerfile +++ b/src/EventsProcessor/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/EventsProcessor RUN . /tmp/rid.txt && dotnet publish -c release -o /app/EventsProcessor --no-restore --no-self-contained -r $RID diff --git a/src/Icons/Dockerfile b/src/Icons/Dockerfile index f4780fe779..026abd22f1 100644 --- a/src/Icons/Dockerfile +++ b/src/Icons/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Icons RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Icons --no-restore --no-self-contained -r $RID diff --git a/src/Identity/Dockerfile b/src/Identity/Dockerfile index cc2bc1618f..fb04d03c5d 100644 --- a/src/Identity/Dockerfile +++ b/src/Identity/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Identity RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Identity --no-restore --no-self-contained -r $RID diff --git a/src/Notifications/Dockerfile b/src/Notifications/Dockerfile index a13d3b4fd9..8e2f59bc93 100644 --- a/src/Notifications/Dockerfile +++ b/src/Notifications/Dockerfile @@ -39,7 +39,7 @@ COPY src/Infrastructure.EntityFramework/. ./src/Infrastructure.EntityFramework/ COPY src/SharedWeb/. ./src/SharedWeb/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/src/Notifications RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Notifications --no-restore --no-self-contained -r $RID diff --git a/util/Attachments/Dockerfile b/util/Attachments/Dockerfile index 407792b1af..e7a97dc0f0 100644 --- a/util/Attachments/Dockerfile +++ b/util/Attachments/Dockerfile @@ -31,7 +31,7 @@ WORKDIR /source COPY util/Server/. ./util/Server/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/util/Server RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Server --no-restore --no-self-contained -r $RID diff --git a/util/MsSqlMigratorUtility/Dockerfile b/util/MsSqlMigratorUtility/Dockerfile index f7c3917fc3..320e14045d 100644 --- a/util/MsSqlMigratorUtility/Dockerfile +++ b/util/MsSqlMigratorUtility/Dockerfile @@ -36,7 +36,7 @@ COPY util/Migrator/. ./util/Migrator/ COPY util/MsSqlMigratorUtility/. ./util/MsSqlMigratorUtility/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/util/MsSqlMigratorUtility RUN . /tmp/rid.txt && dotnet publish -c release -o /app/MsSqlMigratorUtility --no-restore --no-self-contained -r $RID diff --git a/util/Setup/Dockerfile b/util/Setup/Dockerfile index 0b91995f7b..21d6aeb46b 100644 --- a/util/Setup/Dockerfile +++ b/util/Setup/Dockerfile @@ -35,7 +35,7 @@ COPY util/Migrator/. ./util/Migrator/ COPY util/Setup/. ./util/Setup/ COPY .git/. ./.git/ -# Build app +# Build project WORKDIR /source/util/Setup RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Setup --no-restore --no-self-contained -r $RID