Browse Source
* Use IHttpMessageHandlerFactory For HTTP Communication Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> * feat: allow custom app-id.json location for rootless Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> * fix: new build context wont allow copying git context * feat: allow images to run as non-root user * fix: build failures caused by bad merge * build: we don't need to copy the `.git` dir * Revert "build: we don't need to copy the `.git` dir" This reverts commitfix-identity-resource32c2f6236a. * Use `IHttpClientFactory` in more places * update build workflow * fix: compatibility with the existin run.sh script * fix: compatibility with existing run.sh script * Add SelfHosted GlobalSettings for Setup * Fix my build error * Add other services * Add IConfiguration * fix: missing gosu command for rootful mode * fix: try using .net core certificate handling * fix: add `SSL_CERT_DIR` to remaining images * Remove X509ChainCustomization activation code * Revert "Use IHttpMessageHandlerFactory For HTTP Communication" This reverts commitc93be6d52b. * Revert "fix: build failures caused by bad merge" This reverts commit3e4639489b. * Revert "Use `IHttpClientFactory` in more places" This reverts commit284501a493. * remove unused code * re-add error log for installation id * remove missing error message in log * build: remove duplicate docker+qemu setup steps Co-authored-by: Opeyemi <Alaoopeyemi101@gmail.com> * build: optimize for simpler builds over caching * build: restore previous method for getting the GIT_HASH * fix: add missing build args to remaining images * fix: rm extraneous source revision id arg * fmt: apply consistent spacing and rm redundant WORKDIR directive * build: update migrator to use simpler build; apply consistent spacing * fix: merge conflicts; simplify changes * fix: add publish branch check back --------- Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> Co-authored-by: Opeyemi <Alaoopeyemi101@gmail.com>
41 changed files with 1025 additions and 458 deletions
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,21 +1,71 @@
@@ -1,21 +1,71 @@
|
||||
############################################### |
||||
# Build stage # |
||||
############################################### |
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build |
||||
|
||||
# Docker buildx supplies the value for this arg |
||||
ARG TARGETPLATFORM |
||||
|
||||
# Determine proper runtime value for .NET |
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ |
||||
RID=linux-x64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ |
||||
RID=linux-arm64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ |
||||
RID=linux-arm ; \ |
||||
fi \ |
||||
&& echo "RID=$RID" > /tmp/rid.txt |
||||
|
||||
# Set up Node |
||||
ARG NODE_VERSION=20 |
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ |
||||
&& apt-get update \ |
||||
&& apt-get install -y nodejs \ |
||||
&& npm install -g npm@latest && \ |
||||
rm -rf /var/lib/apt/lists/* |
||||
|
||||
# Copy required project files |
||||
WORKDIR /source |
||||
COPY . ./ |
||||
|
||||
# Restore project dependencies and tools |
||||
WORKDIR /source/src/Admin |
||||
RUN npm ci |
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID |
||||
|
||||
# Build project |
||||
RUN npm run build |
||||
RUN . /tmp/rid.txt && dotnet publish \ |
||||
-c release \ |
||||
--no-restore \ |
||||
--self-contained \ |
||||
/p:PublishSingleFile=true \ |
||||
-r $RID \ |
||||
-o out |
||||
|
||||
############################################### |
||||
# App stage # |
||||
############################################### |
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 |
||||
|
||||
ARG TARGETPLATFORM |
||||
LABEL com.bitwarden.product="bitwarden" |
||||
ENV ASPNETCORE_ENVIRONMENT=Production |
||||
ENV ASPNETCORE_URLS=http://+:5000 |
||||
ENV SSL_CERT_DIR=/etc/bitwarden/ca-certificates |
||||
EXPOSE 5000 |
||||
|
||||
RUN apt-get update \ |
||||
&& apt-get install -y --no-install-recommends \ |
||||
gosu \ |
||||
curl \ |
||||
krb5-user \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
|
||||
ENV ASPNETCORE_URLS http://+:5000 |
||||
# Copy app from the build stage |
||||
WORKDIR /app |
||||
EXPOSE 5000 |
||||
COPY obj/build-output/publish . |
||||
COPY entrypoint.sh / |
||||
COPY --from=build /source/src/Admin/out /app |
||||
COPY ./src/Admin/entrypoint.sh /entrypoint.sh |
||||
RUN chmod +x /entrypoint.sh |
||||
|
||||
HEALTHCHECK CMD curl -f http://localhost:5000 || exit 1 |
||||
HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1 |
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"] |
||||
|
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,21 +1,62 @@
@@ -1,21 +1,62 @@
|
||||
############################################### |
||||
# Build stage # |
||||
############################################### |
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build |
||||
|
||||
# Docker buildx supplies the value for this arg |
||||
ARG TARGETPLATFORM |
||||
|
||||
# Determine proper runtime value for .NET |
||||
# We put the value in a file to be read by later layers. |
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ |
||||
RID=linux-x64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ |
||||
RID=linux-arm64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ |
||||
RID=linux-arm ; \ |
||||
fi \ |
||||
&& echo "RID=$RID" > /tmp/rid.txt |
||||
|
||||
# Copy required project files |
||||
WORKDIR /source |
||||
COPY . ./ |
||||
|
||||
# Restore project dependencies and tools |
||||
WORKDIR /source/src/Events |
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID |
||||
|
||||
# Build project |
||||
RUN . /tmp/rid.txt && dotnet publish \ |
||||
-c release \ |
||||
--no-restore \ |
||||
--self-contained \ |
||||
/p:PublishSingleFile=true \ |
||||
-r $RID \ |
||||
-o out |
||||
|
||||
############################################### |
||||
# App stage # |
||||
############################################### |
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 |
||||
|
||||
ARG TARGETPLATFORM |
||||
LABEL com.bitwarden.product="bitwarden" |
||||
ENV ASPNETCORE_ENVIRONMENT=Production |
||||
ENV ASPNETCORE_URLS=http://+:5000 |
||||
ENV SSL_CERT_DIR=/etc/bitwarden/ca-certificates |
||||
EXPOSE 5000 |
||||
|
||||
RUN apt-get update \ |
||||
&& apt-get install -y --no-install-recommends \ |
||||
gosu \ |
||||
curl \ |
||||
krb5-user \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
|
||||
ENV ASPNETCORE_URLS http://+:5000 |
||||
# Copy app from the build stage |
||||
WORKDIR /app |
||||
EXPOSE 5000 |
||||
COPY obj/build-output/publish . |
||||
COPY entrypoint.sh / |
||||
COPY --from=build /source/src/Events/out /app |
||||
COPY ./src/Events/entrypoint.sh /entrypoint.sh |
||||
RUN chmod +x /entrypoint.sh |
||||
|
||||
HEALTHCHECK CMD curl -f http://localhost:5000/alive || exit 1 |
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"] |
||||
|
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
* |
||||
!obj/build-output/publish/* |
||||
!obj/Docker/empty/ |
||||
!entrypoint.sh |
||||
@ -1,8 +1,52 @@
@@ -1,8 +1,52 @@
|
||||
############################################### |
||||
# Build stage # |
||||
############################################### |
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build |
||||
|
||||
# Docker buildx supplies the value for this arg |
||||
ARG TARGETPLATFORM |
||||
|
||||
# Determine proper runtime value for .NET |
||||
# We put the value in a file to be read by later layers. |
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ |
||||
RID=linux-x64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ |
||||
RID=linux-arm64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ |
||||
RID=linux-arm ; \ |
||||
fi \ |
||||
&& echo "RID=$RID" > /tmp/rid.txt |
||||
|
||||
# Copy required project files |
||||
WORKDIR /source |
||||
COPY . ./ |
||||
|
||||
# Restore project dependencies and tools |
||||
WORKDIR /source/util/MsSqlMigratorUtility |
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID |
||||
|
||||
# Build project |
||||
WORKDIR /source/util/MsSqlMigratorUtility |
||||
RUN . /tmp/rid.txt && dotnet publish \ |
||||
-c release \ |
||||
--no-restore \ |
||||
--self-contained \ |
||||
/p:PublishSingleFile=true \ |
||||
-r $RID \ |
||||
-o out |
||||
|
||||
############################################### |
||||
# App stage # |
||||
############################################### |
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 |
||||
|
||||
ARG TARGETPLATFORM |
||||
LABEL com.bitwarden.product="bitwarden" |
||||
|
||||
ENV SSL_CERT_DIR=/etc/bitwarden/ca-certificates |
||||
|
||||
# Copy app from the build stage |
||||
WORKDIR /app |
||||
COPY obj/build-output/publish . |
||||
COPY --from=build /source/util/MsSqlMigratorUtility/out /app |
||||
|
||||
ENTRYPOINT ["sh", "-c", "dotnet /app/MsSqlMigratorUtility.dll \"${MSSQL_CONN_STRING}\" ${@}", "--" ] |
||||
ENTRYPOINT ["sh", "-c", "/app/MsSqlMigratorUtility \"${MSSQL_CONN_STRING}\" ${@}", "--" ] |
||||
|
||||
@ -1,5 +0,0 @@
@@ -1,5 +0,0 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 |
||||
|
||||
LABEL com.bitwarden.product="bitwarden" |
||||
|
||||
COPY obj/build-output/publish /bitwarden_server |
||||
@ -1,16 +1,60 @@
@@ -1,16 +1,60 @@
|
||||
############################################### |
||||
# Build stage # |
||||
############################################### |
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build |
||||
|
||||
# Docker buildx supplies the value for this arg |
||||
ARG TARGETPLATFORM |
||||
|
||||
# Determine proper runtime value for .NET |
||||
# We put the value in a file to be read by later layers. |
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ |
||||
RID=linux-x64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ |
||||
RID=linux-arm64 ; \ |
||||
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ |
||||
RID=linux-arm ; \ |
||||
fi \ |
||||
&& echo "RID=$RID" > /tmp/rid.txt |
||||
|
||||
# Copy required project files |
||||
WORKDIR /source |
||||
COPY . ./ |
||||
|
||||
# Restore project dependencies and tools |
||||
WORKDIR /source/util/Setup |
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID |
||||
|
||||
# Build project |
||||
WORKDIR /source/util/Setup |
||||
RUN . /tmp/rid.txt && dotnet publish \ |
||||
-c release \ |
||||
--no-restore \ |
||||
--self-contained \ |
||||
/p:PublishSingleFile=true \ |
||||
-r $RID \ |
||||
-o out |
||||
|
||||
############################################### |
||||
# App stage # |
||||
############################################### |
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 |
||||
|
||||
ARG TARGETPLATFORM |
||||
LABEL com.bitwarden.product="bitwarden" com.bitwarden.project="setup" |
||||
|
||||
ENV SSL_CERT_DIR=/etc/bitwarden/ca-certificates |
||||
|
||||
RUN apt-get update \ |
||||
&& apt-get install -y --no-install-recommends \ |
||||
openssl \ |
||||
gosu \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
|
||||
# Copy app from the build stage |
||||
WORKDIR /app |
||||
COPY obj/build-output/publish . |
||||
COPY entrypoint.sh / |
||||
COPY --from=build /source/util/Setup/out . |
||||
COPY util/Setup/entrypoint.sh /entrypoint.sh |
||||
RUN chmod +x /entrypoint.sh |
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"] |
||||
|
||||
Loading…
Reference in new issue