-
Notifications
You must be signed in to change notification settings - Fork 1.5k
create new dockerfile for SeederApi #7072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
68455ad
29cd32a
fa32a83
0bb5974
0d9ef57
a53fafe
55fcf99
ba3781b
6d63613
85fc9c1
8d0ceb4
bdf39d0
e1835e5
ad81280
3714dee
f752702
8a69cf2
259a5fc
1bcc9fd
3468ae3
9b18dd1
0377c2e
f0d904d
4b02986
10b612c
eb68c6f
66f1fa8
ad8c4de
38024e4
0aa3bff
c754f65
929cbd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| ############################################### | ||
Check failureCode scanning / Checkmarx One (CVE-2005-2541) Critical
(CVE-2005-2541)
Check failureCode scanning / Checkmarx One (CVE-2019-1010022) Critical
(CVE-2019-1010022)
Check failureCode scanning / Checkmarx One (CVE-2023-45853) Critical
(CVE-2023-45853)
Check failureCode scanning / Checkmarx One (CVE-2025-13151) High
(CVE-2025-13151)
Check failureCode scanning / Checkmarx One (CVE-2024-28757) High
(CVE-2024-28757)
Check failureCode scanning / Checkmarx One (CVE-2025-48384) High
(CVE-2025-48384)
Check failureCode scanning / Checkmarx One (CVE-2026-0861) High
(CVE-2026-0861)
Check failureCode scanning / Checkmarx One (CVE-2025-0725) High
(CVE-2025-0725)
Check failureCode scanning / Checkmarx One (CVE-2025-15281) High
(CVE-2025-15281)
Check failureCode scanning / Checkmarx One (CVE-2015-3276) High
(CVE-2015-3276)
Check failureCode scanning / Checkmarx One (CVE-2017-18018) High
(CVE-2017-18018)
Check failureCode scanning / Checkmarx One (CVE-2022-24975) High
(CVE-2022-24975)
Check failureCode scanning / Checkmarx One (CVE-2024-26461) High
(CVE-2024-26461)
Check failureCode scanning / Checkmarx One (CVE-2019-9192) High
(CVE-2019-9192)
Check failureCode scanning / Checkmarx One (CVE-2018-5709) High
(CVE-2018-5709)
Check failureCode scanning / Checkmarx One (CVE-2025-6297) High
(CVE-2025-6297)
Check failureCode scanning / Checkmarx One (CVE-2026-24882) High
(CVE-2026-24882)
Check failureCode scanning / Checkmarx One (CVE-2018-6829) High
(CVE-2018-6829)
Check failureCode scanning / Checkmarx One (CVE-2025-9086) High
(CVE-2025-9086)
Check failureCode scanning / Checkmarx One (CVE-2018-20796) High
(CVE-2018-20796)
Check failureCode scanning / Checkmarx One (CVE-2025-59375) High
(CVE-2025-59375)
Check failureCode scanning / Checkmarx One (CVE-2025-46835) High
(CVE-2025-46835)
Check failureCode scanning / Checkmarx One (CVE-2025-48385) High
(CVE-2025-48385)
Check failureCode scanning / Checkmarx One (CVE-2023-2953) High
(CVE-2023-2953)
Check failureCode scanning / Checkmarx One (CVE-2024-52005) High
(CVE-2024-52005)
Check failureCode scanning / Checkmarx One (CVE-2017-17740) High
(CVE-2017-17740)
Check failureCode scanning / Checkmarx One (CVE-2023-31486) High
(CVE-2023-31486)
|
||
Check failureCode scanning / Checkmarx One (CVE-2024-38095) High
(CVE-2024-38095)
Check failureCode scanning / Checkmarx One (CVE-2025-55247) High
(CVE-2025-55247)
Check failureCode scanning / Checkmarx One (CVE-2025-55247) High
(CVE-2025-55247)
Check failureCode scanning / Checkmarx One (CVE-2025-26646) High
(CVE-2025-26646)
Check failureCode 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"] | ||
Check failure
Code scanning / Checkmarx One
(CVE-2025-55247) High