diff --git a/Dockerfile b/Dockerfile index 3cd709638..b4dfed7c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 @@ -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 @@ -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 @@ -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"] \ No newline at end of file +ENTRYPOINT ["dotnet", "ArmoniK.Core.Control.Submitter.dll"] diff --git a/Tests/Bench/Client/src/Dockerfile b/Tests/Bench/Client/src/Dockerfile index 0d84a2916..0fa9c6a7b 100644 --- a/Tests/Bench/Client/src/Dockerfile +++ b/Tests/Bench/Client/src/Dockerfile @@ -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 @@ -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"] diff --git a/Tests/Bench/Server/src/Dockerfile b/Tests/Bench/Server/src/Dockerfile index 798fd5357..e20ce42e9 100644 --- a/Tests/Bench/Server/src/Dockerfile +++ b/Tests/Bench/Server/src/Dockerfile @@ -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 @@ -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"] diff --git a/Tests/CrashingWorker/Server/src/Dockerfile b/Tests/CrashingWorker/Server/src/Dockerfile index 045965f23..865870c9c 100644 --- a/Tests/CrashingWorker/Server/src/Dockerfile +++ b/Tests/CrashingWorker/Server/src/Dockerfile @@ -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 @@ -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"] diff --git a/Tests/HtcMock/Client/src/Dockerfile b/Tests/HtcMock/Client/src/Dockerfile index e4263dcf8..d1d2138be 100644 --- a/Tests/HtcMock/Client/src/Dockerfile +++ b/Tests/HtcMock/Client/src/Dockerfile @@ -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 @@ -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"] diff --git a/Tests/HtcMock/Server/src/Dockerfile b/Tests/HtcMock/Server/src/Dockerfile index 3cf709e31..fa6fb2182 100644 --- a/Tests/HtcMock/Server/src/Dockerfile +++ b/Tests/HtcMock/Server/src/Dockerfile @@ -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 @@ -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"] diff --git a/Tests/Stream/Server/Dockerfile b/Tests/Stream/Server/Dockerfile index c50a85872..aba212166 100644 --- a/Tests/Stream/Server/Dockerfile +++ b/Tests/Stream/Server/Dockerfile @@ -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 @@ -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"] diff --git a/terraform/modules/compute_plane/main.tf b/terraform/modules/compute_plane/main.tf index f974f9e1b..545349a24 100644 --- a/terraform/modules/compute_plane/main.tf +++ b/terraform/modules/compute_plane/main.tf @@ -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" { @@ -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 @@ -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 = {