Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
68455ad
create new dockerfile for SeederApi
AmyLGalles Feb 24, 2026
29cd32a
troubleshoot cargo issues
AmyLGalles Feb 24, 2026
fa32a83
troubleshoot cargo issues
AmyLGalles Feb 24, 2026
0bb5974
Merge branch 'main' into agalles/BRE-1618-SeederAPI-Docker
AmyLGalles Feb 24, 2026
0d9ef57
Ensure Rustup run on build env for appropriate target
MGibson1 Feb 24, 2026
a53fafe
Musl targets do not support cdylibs
MGibson1 Feb 24, 2026
55fcf99
Ensure default triple set to target
MGibson1 Feb 25, 2026
ba3781b
Set target triple rather than update default host
MGibson1 Feb 25, 2026
6d63613
Change build platforms per project
MGibson1 Feb 25, 2026
85fc9c1
Switch to debian since we can't use musl
MGibson1 Feb 26, 2026
8d0ceb4
Debian build for seeder should work with arm targets
MGibson1 Feb 26, 2026
bdf39d0
Move app stage to distroless
MGibson1 Feb 26, 2026
e1835e5
remove SeederApi from server publish section
AmyLGalles Feb 26, 2026
ad81280
Merge branch 'agalles/BRE-1618-SeederAPI-Docker' of github.com:bitwar…
AmyLGalles Feb 26, 2026
3714dee
suppress unrelated warnings"
AmyLGalles Feb 26, 2026
f752702
ruling out builds as error source
AmyLGalles Feb 26, 2026
8a69cf2
Merge branch 'main' into agalles/BRE-1618-SeederAPI-Docker
AmyLGalles Feb 26, 2026
259a5fc
override platforms for SeederApi
AmyLGalles Feb 26, 2026
1bcc9fd
troubleshoot matrix
AmyLGalles Feb 26, 2026
3468ae3
add extra step for evaluating platforms
AmyLGalles Feb 26, 2026
9b18dd1
fix syntax error
AmyLGalles Feb 26, 2026
0377c2e
exclude unrelated error
AmyLGalles Feb 27, 2026
f0d904d
exclude unrelated error
AmyLGalles Feb 27, 2026
4b02986
exclude unrelated error
AmyLGalles Feb 27, 2026
10b612c
exclude unrelated error
AmyLGalles Feb 27, 2026
eb68c6f
exclude unrelated error
AmyLGalles Feb 28, 2026
66f1fa8
temporarily reduce number of builds
AmyLGalles Feb 28, 2026
ad8c4de
exclude unrelated error
AmyLGalles Feb 28, 2026
38024e4
remove temporary block on other builds
AmyLGalles Feb 28, 2026
0aa3bff
Merge branch 'main' into agalles/BRE-1618-SeederAPI-Docker
AmyLGalles Feb 28, 2026
c754f65
remove unused builds from dockerfile
AmyLGalles Feb 28, 2026
929cbd3
Merge branch 'agalles/BRE-1618-SeederAPI-Docker' of github.com:bitwar…
AmyLGalles Feb 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ jobs:
- project_name: Scim
base_path: ./bitwarden_license/src
dotnet: true
- project_name: SeederApi
base_path: ./util
platforms: linux/amd64,linux/arm64
dotnet: true
- project_name: Setup
base_path: ./util
dotnet: true
Expand Down Expand Up @@ -214,6 +218,7 @@ jobs:
echo "Matrix name: ${{ matrix.project_name }}"
echo "PROJECT_NAME: $PROJECT_NAME"
echo "project_name=$PROJECT_NAME" >> "$GITHUB_OUTPUT"
echo "platforms: ${{ matrix.platforms }}" >> "$GITHUB_STEP_SUMMARY"

- name: Generate image tags(s)
id: image-tags
Expand All @@ -230,16 +235,22 @@ jobs:
fi
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"

- name: Set platforms
id: platforms
run: |
PLATFORMS="${{ matrix.platforms }}"
if [ -z "$PLATFORMS" ]; then
PLATFORMS="linux/amd64,linux/arm/v7,linux/arm64"
fi
echo "platforms=$PLATFORMS" >> "$GITHUB_OUTPUT"

- name: Build Docker image
id: build-artifacts
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ${{ matrix.base_path }}/${{ matrix.project_name }}/Dockerfile
platforms: |
linux/amd64,
linux/arm/v7,
linux/arm64
platforms: ${{ steps.platforms.outputs.platforms }}
push: true
tags: ${{ steps.image-tags.outputs.tags }}

Expand Down
115 changes: 115 additions & 0 deletions util/SeederApi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
###############################################

Check failure

Code scanning / Checkmarx One

(CVE-2005-2541) Critical

(CVE-2005-2541)

Check failure

Code scanning / Checkmarx One

(CVE-2019-1010022) Critical

(CVE-2019-1010022)

Check failure

Code scanning / Checkmarx One

(CVE-2023-45853) Critical

(CVE-2023-45853)

Check failure

Code scanning / Checkmarx One

(CVE-2025-13151) High

(CVE-2025-13151)

Check failure

Code scanning / Checkmarx One

(CVE-2024-28757) High

(CVE-2024-28757)

Check failure

Code scanning / Checkmarx One

(CVE-2025-48384) High

(CVE-2025-48384)

Check failure

Code scanning / Checkmarx One

(CVE-2026-0861) High

(CVE-2026-0861)

Check failure

Code scanning / Checkmarx One

(CVE-2025-0725) High

(CVE-2025-0725)

Check failure

Code scanning / Checkmarx One

(CVE-2025-15281) High

(CVE-2025-15281)

Check failure

Code scanning / Checkmarx One

(CVE-2015-3276) High

(CVE-2015-3276)

Check failure

Code scanning / Checkmarx One

(CVE-2017-18018) High

(CVE-2017-18018)

Check failure

Code scanning / Checkmarx One

(CVE-2022-24975) High

(CVE-2022-24975)

Check failure

Code scanning / Checkmarx One

(CVE-2024-26461) High

(CVE-2024-26461)

Check failure

Code scanning / Checkmarx One

(CVE-2019-9192) High

(CVE-2019-9192)

Check failure

Code scanning / Checkmarx One

(CVE-2018-5709) High

(CVE-2018-5709)

Check failure

Code scanning / Checkmarx One

(CVE-2025-6297) High

(CVE-2025-6297)

Check failure

Code scanning / Checkmarx One

(CVE-2026-24882) High

(CVE-2026-24882)

Check failure

Code scanning / Checkmarx One

(CVE-2018-6829) High

(CVE-2018-6829)

Check failure

Code scanning / Checkmarx One

(CVE-2025-9086) High

(CVE-2025-9086)

Check failure

Code scanning / Checkmarx One

(CVE-2018-20796) High

(CVE-2018-20796)

Check failure

Code scanning / Checkmarx One

(CVE-2025-59375) High

(CVE-2025-59375)

Check failure

Code scanning / Checkmarx One

(CVE-2025-46835) High

(CVE-2025-46835)

Check failure

Code scanning / Checkmarx One

(CVE-2025-48385) High

(CVE-2025-48385)

Check failure

Code scanning / Checkmarx One

(CVE-2023-2953) High

(CVE-2023-2953)

Check failure

Code scanning / Checkmarx One

(CVE-2024-52005) High

(CVE-2024-52005)

Check failure

Code scanning / Checkmarx One

(CVE-2017-17740) High

(CVE-2017-17740)

Check failure

Code scanning / Checkmarx One

(CVE-2023-31486) High

(CVE-2023-31486)

Check failure

Code scanning / Checkmarx One

(CVE-2025-55247) High

(CVE-2025-55247)

Check failure

Code scanning / Checkmarx One

(CVE-2024-38095) High

(CVE-2024-38095)

Check failure

Code scanning / Checkmarx One

(CVE-2025-55247) High

(CVE-2025-55247)

Check failure

Code scanning / Checkmarx One

(CVE-2025-55247) High

(CVE-2025-55247)

Check failure

Code scanning / Checkmarx One

(CVE-2025-26646) High

(CVE-2025-26646)

Check failure

Code scanning / Checkmarx One

(CVE-2025-26646) High

(CVE-2025-26646)
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build

# Docker buildx supplies these values
ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Install base build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

# Install Rust toolchain on build platform
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
--default-toolchain stable \
--profile minimal \
--no-modify-path

ENV PATH="/root/.cargo/bin:${PATH}"

# Determine target architecture and install cross-compilation tools
RUN case "$TARGETPLATFORM" in \
"linux/amd64") \
RUST_TARGET=x86_64-unknown-linux-gnu && \
RID=linux-x64 && \
ARCH_PACKAGES="" \
;; \
"linux/arm64") \
RUST_TARGET=aarch64-unknown-linux-gnu && \
RID=linux-arm64 && \
ARCH_PACKAGES="gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross" \
;; \
*) \
echo "Unsupported platform: $TARGETPLATFORM" && exit 1 \
;; \
esac \
&& if [ -n "$ARCH_PACKAGES" ]; then \
apt-get update && apt-get install -y $ARCH_PACKAGES && rm -rf /var/lib/apt/lists/* ; \
fi \
&& echo "RUST_TARGET=${RUST_TARGET}" >> /etc/environment \
&& echo "RID=${RID}" >> /etc/environment \
&& . /etc/environment \
&& rustup target add ${RUST_TARGET} \
&& echo "Rust target: ${RUST_TARGET}, .NET RID: ${RID}"

# Configure Rust for cross-compilation with proper linkers
RUN . /etc/environment \
&& mkdir -p /root/.cargo \
&& case "$TARGETPLATFORM" in \
"linux/amd64") \
echo "[target.x86_64-unknown-linux-gnu]" >> /root/.cargo/config.toml \
&& echo "linker = \"gcc\"" >> /root/.cargo/config.toml \
;; \
"linux/arm64") \
echo "[target.aarch64-unknown-linux-gnu]" >> /root/.cargo/config.toml \
&& echo "linker = \"aarch64-linux-gnu-gcc\"" >> /root/.cargo/config.toml \
;; \
esac

# Copy project files
WORKDIR /source
COPY . ./

# Restore .NET dependencies
WORKDIR /source/util/SeederApi
RUN . /etc/environment && dotnet restore -r ${RID}

# Build the project with Rust support
WORKDIR /source/util/SeederApi
RUN . /etc/environment \
&& export CARGO_TARGET_DIR=/tmp/cargo_target \
&& export NoWarn="CA1305;CS1591" \
&& rustc --version \
&& cargo --version \
&& echo "Building for Rust target: ${RUST_TARGET}, .NET RID: ${RID}" \
&& dotnet publish SeederApi.csproj \
-c Release \
--no-restore \
--self-contained \
/p:PublishSingleFile=true \
-r ${RID} \
-o /app/out

###############################################
# App stage #
###############################################
FROM mcr.microsoft.com/dotnet/aspnet:8.0-azurelinux3.0-distroless-extra AS app

ARG TARGETPLATFORM
LABEL com.bitwarden.product="bitwarden"

ENV SSL_CERT_DIR=/etc/bitwarden/ca-certificates
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:5000
EXPOSE 5000

# Set up health check wrapper
# Get the executable and copy it to any path you want
COPY --from=ghcr.io/alexaka1/distroless-dotnet-healthchecks:1 / /healthcheck
# Setup your healthcheck endpoints via environment variable in Dockerfile, or at runtime via `docker run -e DISTROLESS_HEALTHCHECKS_URIS__0="http://localhost/healthz" -e DISTROLESS_HEALTHCHECKS_URIS__1="http://localhost/some/other/endpoint"`
ENV DISTROLESS_HEALTHCHECKS_URI="http://localhost:5000/alive"
# Setup the healthcheck using the EXEC array syntax
HEALTHCHECK CMD ["/healthcheck/Distroless.HealthChecks"]

# Copy app from the build stage
WORKDIR /app
COPY --from=build /app/out /app

ENTRYPOINT ["/app/SeederApi"]
Loading