Skip to content
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

feat: use dotnet 8 chiseled images #572

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 as base
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled as base

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG VERSION=1.0.0.0
Expand Down Expand Up @@ -80,8 +79,7 @@ WORKDIR /adapters/queue/rabbit
COPY --from=build /app/publish/rabbit .
WORKDIR /app
COPY --from=build /app/publish/polling_agent .
RUN mkdir /cache /local_storage && chown armonikuser: /cache /local_storage
USER armonikuser
USER $APP_UID

ENV ASPNETCORE_URLS http://+:1080
EXPOSE 1080
Expand All @@ -92,7 +90,7 @@ ENTRYPOINT ["dotnet", "ArmoniK.Core.Compute.PollingAgent.dll"]
FROM base as metrics
WORKDIR /app
COPY --from=build /app/publish/metrics .
USER armonikuser
USER $APP_UID

ENV ASPNETCORE_URLS http://+:1080
EXPOSE 1080
Expand All @@ -103,7 +101,7 @@ ENTRYPOINT ["dotnet", "ArmoniK.Core.Control.Metrics.dll"]
FROM base as partition_metrics
WORKDIR /app
COPY --from=build /app/publish/partition_metrics .
USER armonikuser
USER $APP_UID

ENV ASPNETCORE_URLS http://+:1080
EXPOSE 1080
Expand All @@ -120,11 +118,10 @@ WORKDIR /adapters/queue/rabbit
COPY --from=build /app/publish/rabbit .
WORKDIR /app
COPY --from=build /app/publish/submitter .
RUN mkdir /local_storage && chown armonikuser: /local_storage
USER armonikuser
USER $APP_UID

ENV ASPNETCORE_URLS http://+:1080, http://+:1081
EXPOSE 1080
EXPOSE 1081

ENTRYPOINT ["dotnet", "ArmoniK.Core.Control.Submitter.dll"]
ENTRYPOINT ["dotnet", "ArmoniK.Core.Control.Submitter.dll"]
6 changes: 2 additions & 4 deletions Tests/Bench/Client/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
WORKDIR /app

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
Expand All @@ -19,7 +19,5 @@ RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.Samples.Bench.Client.csproj" --no
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser

USER armonikuser
USER $APP_UID
ENTRYPOINT ["dotnet", "ArmoniK.Samples.Bench.Client.dll"]
6 changes: 2 additions & 4 deletions Tests/Bench/Server/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
WORKDIR /app

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
Expand All @@ -17,8 +17,6 @@ RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.Samples.Bench.Server.csproj" -o /
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser
RUN mkdir /cache && chown armonikuser: /cache
USER armonikuser
USER $APP_UID
EXPOSE 1080
ENTRYPOINT ["dotnet", "ArmoniK.Samples.Bench.Server.dll"]
6 changes: 2 additions & 4 deletions Tests/CrashingWorker/Server/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
WORKDIR /app

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
Expand All @@ -17,8 +17,6 @@ RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.Samples.CrashingWorker.Server.csp
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser
RUN mkdir /cache && chown armonikuser: /cache
USER armonikuser
EXPOSE 1080
USER $APP_UID
ENTRYPOINT ["dotnet", "ArmoniK.Samples.CrashingWorker.Server.dll"]
6 changes: 2 additions & 4 deletions Tests/HtcMock/Client/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
WORKDIR /app

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
Expand All @@ -19,7 +19,5 @@ RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.Samples.HtcMock.Client.csproj" --
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser

USER armonikuser
USER $APP_UID
ENTRYPOINT ["dotnet", "ArmoniK.Samples.HtcMock.Client.dll"]
6 changes: 2 additions & 4 deletions Tests/HtcMock/Server/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
WORKDIR /app

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
Expand All @@ -17,8 +17,6 @@ RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.Samples.HtcMock.Server.csproj" -o
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser
RUN mkdir /cache && chown armonikuser: /cache
USER armonikuser
EXPOSE 1080
USER $APP_UID
ENTRYPOINT ["dotnet", "ArmoniK.Samples.HtcMock.Server.dll"]
6 changes: 2 additions & 4 deletions Tests/Stream/Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
WORKDIR /app
ENV ASPNETCORE_URLS http://+:1080;https://+1443
EXPOSE 1080
Expand All @@ -22,8 +22,6 @@ RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.Extensions.Common.StreamWrapper.T
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN groupadd --gid 5000 armonikuser && useradd --home-dir /home/armonikuser --create-home --uid 5000 --gid 5000 --shell /bin/sh --skel /dev/null armonikuser
RUN mkdir /cache && chown armonikuser: /cache
USER armonikuser
USER $APP_UID

ENTRYPOINT ["dotnet", "ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.dll"]
7 changes: 7 additions & 0 deletions terraform/modules/compute_plane/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
resource "docker_volume" "socket_vol" {
name = "socket_vol${var.replica_counter}"
driver_opts = {
o : "mode=0777"
device : "tmpfs"
type : "tmpfs"
}
}

resource "docker_image" "worker" {
Expand All @@ -18,6 +23,7 @@ resource "docker_container" "worker" {
env = concat(["Serilog__Properties__Application=${var.worker.serilog_application_name}"], local.gen_env, local.common_env)

log_driver = var.log_driver.name
user = 3333

log_opts = {
fluentd-address = var.log_driver.address
Expand Down Expand Up @@ -52,6 +58,7 @@ resource "docker_container" "polling_agent" {

env = concat(local.env, local.gen_env, local.common_env)

user = 3333
log_driver = var.log_driver.name

log_opts = {
Expand Down