mirror of
https://github.com/bitwarden/server.git
synced 2025-05-27 22:34:54 -05:00
Move all build steps to project Dockerfiles
This commit is contained in:
parent
82cd28e6c0
commit
d21717e1d5
102
.github/workflows/build.yml
vendored
102
.github/workflows/build.yml
vendored
@ -195,88 +195,9 @@ jobs:
|
||||
path: ${{ matrix.base_path }}/${{ matrix.project_name }}/${{ matrix.project_name }}.zip
|
||||
if-no-files-found: error
|
||||
|
||||
build:
|
||||
if: false
|
||||
name: Build projects
|
||||
runs-on: ubuntu-22.04
|
||||
# needs:
|
||||
# - lint
|
||||
# - testing
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Set up QEMU emulators
|
||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
||||
|
||||
########## ACRs ##########
|
||||
# - name: Login to Azure - PROD Subscription
|
||||
# uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
||||
# with:
|
||||
# creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
||||
|
||||
# - name: Login to PROD ACR
|
||||
# run: az acr login -n ${_AZ_REGISTRY%.azurecr.io}
|
||||
|
||||
- name: Login to Azure - CI Subscription
|
||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||
|
||||
- name: Retrieve Storage Account secret
|
||||
id: retrieve-secret
|
||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
||||
with:
|
||||
keyvault: "bitwarden-ci"
|
||||
secrets: "storage-account-dockerimagetest-conn-string"
|
||||
|
||||
# - name: Generate image full name
|
||||
# id: image-name
|
||||
# run: |
|
||||
# IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
|
||||
# if [[ "$IMAGE_TAG" == "master" ]]; then
|
||||
# IMAGE_TAG=dev
|
||||
# fi
|
||||
# echo "name=${_AZ_REGISTRY}/build:${IMAGE_TAG}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
with:
|
||||
context: .
|
||||
file: build.Dockerfile
|
||||
platforms: |
|
||||
linux/amd64,
|
||||
linux/arm/v7,
|
||||
linux/arm64
|
||||
# push: true
|
||||
outputs: type=oci,dest=/tmp/build.tar
|
||||
# tags: ${{ steps.image-name.outputs.name }}
|
||||
tags: build:latest
|
||||
# secrets: |
|
||||
# "GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}"
|
||||
|
||||
- name: Upload artifact
|
||||
run: |
|
||||
ls -alh /tmp
|
||||
az storage blob upload \
|
||||
--file /tmp/build.tar \
|
||||
--container-name builds \
|
||||
--name build \
|
||||
--connection-string '${{ env.storage-account-dockerimagetest-conn-string }}'
|
||||
|
||||
build-docker:
|
||||
name: Build Docker images
|
||||
runs-on: ubuntu-22.04
|
||||
# needs:
|
||||
# - build
|
||||
services:
|
||||
registry:
|
||||
image: registry:2
|
||||
ports:
|
||||
- 5000:5000
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@ -346,24 +267,7 @@ jobs:
|
||||
- name: Login to PROD ACR
|
||||
run: az acr login -n ${_AZ_REGISTRY%.azurecr.io}
|
||||
|
||||
- name: Login to Azure - CI Subscription
|
||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||
|
||||
########## Generate image tag and build Docker image ##########
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
with:
|
||||
context: .
|
||||
file: build.Dockerfile
|
||||
platforms: |
|
||||
linux/amd64,
|
||||
linux/arm/v7,
|
||||
linux/arm64
|
||||
push: true
|
||||
tags: localhost:5000/build:latest
|
||||
|
||||
- name: Generate Docker image tag
|
||||
id: tag
|
||||
run: |
|
||||
@ -391,9 +295,9 @@ jobs:
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
with:
|
||||
# build-args: |
|
||||
# BUILD_TAG=${{ steps.tag.outputs.image_tag }}
|
||||
context: ${{ matrix.base_path }}/${{ matrix.project_name }}
|
||||
build-args: |
|
||||
BUILD_TAG=${{ steps.tag.outputs.image_tag }}
|
||||
context: .
|
||||
file: ${{ matrix.base_path }}/${{ matrix.project_name }}/Dockerfile
|
||||
platforms: |
|
||||
linux/amd64,
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY bitwarden_license/src/Scim/*.csproj ./bitwarden_license/src/Scim/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Scim project dependencies and tools
|
||||
WORKDIR /source/bitwarden_license/src/Scim
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY bitwarden_license/src/Scim/. ./bitwarden_license/src/Scim/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Scim app
|
||||
WORKDIR /source/bitwarden_license/src/Scim
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Scim --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Scim ./
|
||||
COPY --from=build /app/Scim ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY bitwarden_license/src/Sso/*.csproj ./bitwarden_license/src/Sso/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Sso project dependencies and tools
|
||||
WORKDIR /source/bitwarden_license/src/Sso
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY bitwarden_license/src/Sso/. ./bitwarden_license/src/Sso/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Sso app
|
||||
WORKDIR /source/bitwarden_license/src/Sso
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Sso --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Sso ./
|
||||
COPY --from=build /app/Sso ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,57 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Admin/*.csproj ./src/Admin/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY util/Migrator/*.csproj ./util/Migrator/
|
||||
COPY util/MySqlMigrations/*.csproj ./util/MySqlMigrations/
|
||||
COPY util/PostgresMigrations/*.csproj ./util/PostgresMigrations/
|
||||
COPY util/SqliteMigrations/*.csproj ./util/SqliteMigrations/
|
||||
COPY bitwarden_license/src/Commercial.Core/*.csproj ./bitwarden_license/src/Commercial.Core/
|
||||
COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/*.csproj ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Admin project dependencies and tools
|
||||
WORKDIR /source/src/Admin
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Admin/. ./src/Admin/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
COPY util/Migrator/. ./util/Migrator/
|
||||
COPY util/MySqlMigrations/. ./util/MySqlMigrations/
|
||||
COPY util/PostgresMigrations/. ./util/PostgresMigrations/
|
||||
COPY util/SqliteMigrations/. ./util/SqliteMigrations/
|
||||
COPY bitwarden_license/src/Commercial.Core/. ./bitwarden_license/src/Commercial.Core/
|
||||
COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/. ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Admin app
|
||||
WORKDIR /source/src/Admin
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Admin --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +72,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Admin ./
|
||||
COPY --from=build /app/Admin ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,49 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Api/*.csproj ./src/Api/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY bitwarden_license/src/Commercial.Core/*.csproj ./bitwarden_license/src/Commercial.Core/
|
||||
COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/*.csproj ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Api project dependencies and tools
|
||||
WORKDIR /source/src/Api
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Api/. ./src/Api/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
COPY bitwarden_license/src/Commercial.Core/. ./bitwarden_license/src/Commercial.Core/
|
||||
COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/. ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Api app
|
||||
WORKDIR /source/src/Api
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Api --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +64,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Api ./
|
||||
COPY --from=build /app/Api ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Billing/*.csproj ./src/Billing/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Billing project dependencies and tools
|
||||
WORKDIR /source/src/Billing
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Billing/. ./src/Billing/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Billing app
|
||||
WORKDIR /source/src/Billing
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Billing --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Billing ./
|
||||
COPY --from=build /app/Billing ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Events/*.csproj ./src/Events/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Events project dependencies and tools
|
||||
WORKDIR /source/src/Events
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Events/. ./src/Events/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Events app
|
||||
WORKDIR /source/src/Events
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Events --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Admin ./
|
||||
COPY --from=build /app/Admin ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/EventsProcessor/*.csproj ./src/EventsProcessor/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore EventsProcessor project dependencies and tools
|
||||
WORKDIR /source/src/EventsProcessor
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/EventsProcessor/. ./src/EventsProcessor/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build EventsProcessor app
|
||||
WORKDIR /source/src/EventsProcessor
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/EventsProcessor --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/EventsProcessor ./
|
||||
COPY --from=build /app/EventsProcessor ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Icons/*.csproj ./src/Icons/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Icons project dependencies and tools
|
||||
WORKDIR /source/src/Icons
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Icons/. ./src/Icons/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Icons app
|
||||
WORKDIR /source/src/Icons
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Icons --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Icons ./
|
||||
COPY --from=build /app/Icons ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,57 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Admin/*.csproj ./src/Admin/
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY util/Migrator/*.csproj ./util/Migrator/
|
||||
COPY util/MySqlMigrations/*.csproj ./util/MySqlMigrations/
|
||||
COPY util/PostgresMigrations/*.csproj ./util/PostgresMigrations/
|
||||
COPY util/SqliteMigrations/*.csproj ./util/SqliteMigrations/
|
||||
COPY bitwarden_license/src/Commercial.Core/*.csproj ./bitwarden_license/src/Commercial.Core/
|
||||
COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/*.csproj ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Admin project dependencies and tools
|
||||
WORKDIR /source/src/Admin
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Admin/. ./src/Admin/
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
COPY util/Migrator/. ./util/Migrator/
|
||||
COPY util/MySqlMigrations/. ./util/MySqlMigrations/
|
||||
COPY util/PostgresMigrations/. ./util/PostgresMigrations/
|
||||
COPY util/SqliteMigrations/. ./util/SqliteMigrations/
|
||||
COPY bitwarden_license/src/Commercial.Core/. ./bitwarden_license/src/Commercial.Core/
|
||||
COPY bitwarden_license/src/Commercial.Infrastructure.EntityFramework/. ./bitwarden_license/src/Commercial.Infrastructure.EntityFramework/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Admin app
|
||||
WORKDIR /source/src/Admin
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Admin --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +72,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Identity ./
|
||||
COPY --from=build /app/Identity ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,45 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY src/Core/*.csproj ./src/Core/
|
||||
COPY src/Notifications/*.csproj ./src/Notifications/
|
||||
COPY src/SharedWeb/*.csproj ./src/SharedWeb/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Notifications project dependencies and tools
|
||||
WORKDIR /source/src/Notifications
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY src/Core/. ./src/Core/
|
||||
COPY src/Notifications/. ./src/Notifications/
|
||||
COPY src/SharedWeb/. ./src/SharedWeb/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Notifications app
|
||||
WORKDIR /source/src/Notifications
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Notifications --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +60,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Notifications ./
|
||||
COPY --from=build /app/Notifications ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,41 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY util/Server/*.csproj ./util/Server/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Server project dependencies and tools
|
||||
WORKDIR /source/util/Server
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY util/Server/. ./util/Server/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Server app
|
||||
WORKDIR /source/util/Server
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Server --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -23,7 +56,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /bitwarden_server
|
||||
COPY --from=bitwarden-build /app/Server ./
|
||||
COPY --from=build /app/Server ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
@ -1,8 +1,41 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY util/Server/*.csproj ./util/Server/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Server project dependencies and tools
|
||||
WORKDIR /source/util/Server
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY util/Server/. ./util/Server/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Server app
|
||||
WORKDIR /source/util/Server
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Server --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -13,4 +46,4 @@ LABEL com.bitwarden.product="bitwarden"
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /bitwarden_server
|
||||
COPY --from=bitwarden-build /app/Server ./
|
||||
COPY --from=build /app/Server ./
|
@ -1,8 +1,42 @@
|
||||
###############################################
|
||||
# Build stage #
|
||||
###############################################
|
||||
ARG BUILD_TAG=latest
|
||||
FROM --platform=$BUILDPLATFORM localhost:5000/build:${BUILD_TAG} AS bitwarden-build
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.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 csproj files as distinct layers
|
||||
WORKDIR /source
|
||||
COPY util/Migrator/*.csproj ./util/Migrator/
|
||||
COPY util/Setup/*.csproj ./util/Setup/
|
||||
COPY Directory.Build.props .
|
||||
|
||||
# Restore Setup project dependencies and tools
|
||||
WORKDIR /source/util/Setup
|
||||
RUN . /tmp/rid.txt && dotnet restore -r $RID
|
||||
|
||||
# Copy required project files
|
||||
WORKDIR /source
|
||||
COPY util/Setup/. ./util/Setup/
|
||||
# COPY .git/. ./.git/
|
||||
|
||||
# Build Setup app
|
||||
WORKDIR /source/util/Setup
|
||||
RUN . /tmp/rid.txt && dotnet publish -c release -o /app/Setup --no-restore --no-self-contained -r $RID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
###############################################
|
||||
# App stage #
|
||||
@ -20,7 +54,7 @@ RUN apt-get update \
|
||||
|
||||
# Copy app from the build stage
|
||||
WORKDIR /app
|
||||
COPY --from=bitwarden-build /app/Setup ./
|
||||
COPY --from=build /app/Setup ./
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user