From 4c6400234bb87110ea0e5dc20aee8875ad06fb01 Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Wed, 24 Apr 2024 16:07:01 -0400 Subject: [PATCH 1/6] Finalize net8 Dockerfile changes --- Dockerfile | 6 +++--- Dockerfile.arm64 | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ea944506bc..ef1a696b22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,10 +26,10 @@ ARG DEBIAN_FRONTEND="noninteractive" WORKDIR /ace # install net-tools (netstat for health check) & cleanup -RUN apt update && \ - apt install --no-install-recommends -y \ +RUN apt-get update && \ + apt-get install --no-install-recommends -y \ net-tools && \ - apt clean && \ + apt-get clean && \ rm -rf \ /tmp/* \ /var/lib/apt/lists/* \ diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index efc6550e91..987e5392fb 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -1,6 +1,7 @@ -# This Dockerfile, specific to arm64 should be no longer needed. Leaving in place for legacy purposes for now. +# This Dockerfile, specific to arm64, should be no longer needed. Leaving in place for legacy purposes. FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build +ARG TARGETARCH WORKDIR /Source # copy csproj and restore as distinct layers @@ -27,10 +28,10 @@ ARG DEBIAN_FRONTEND="noninteractive" WORKDIR /ace # install net-tools (netstat for health check) & cleanup -RUN apt update && \ - apt install --no-install-recommends -y \ +RUN apt-get update && \ + apt-get install --no-install-recommends -y \ net-tools && \ - apt clean && \ + apt-get clean && \ rm -rf \ /tmp/* \ /var/lib/apt/lists/* \ From c408a8ff490bb95a6077512481374594be5ce6dd Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Wed, 24 Apr 2024 17:36:26 -0400 Subject: [PATCH 2/6] Update docker-compose.arm64 --- docker-compose.arm64 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.arm64 b/docker-compose.arm64 index faa42cb587..7690e02085 100644 --- a/docker-compose.arm64 +++ b/docker-compose.arm64 @@ -1,3 +1,5 @@ +# This docker-compose file, specific to arm64, should be no longer needed. Leaving in place for legacy purposes. + #version: '3' services: @@ -22,8 +24,8 @@ services: context: . dockerfile: Dockerfile.arm64 image: acemulator/ace:latest-arm64 - depends_on: - - ace-db + ace-db: + condition: service_healthy container_name: ace-server env_file: - docker.env From 1e2a32bb72f606c44fa20db712c334ac536a73fc Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Wed, 24 Apr 2024 17:36:29 -0400 Subject: [PATCH 3/6] Update docker-compose.yml --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a2642ed06b..384e14e8e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,8 @@ services: build: . image: acemulator/ace:latest depends_on: - - ace-db + ace-db: + condition: service_healthy container_name: ace-server env_file: - docker.env From 7a602afedee5988d10c1b823f7250607efc82bba Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Wed, 24 Apr 2024 17:36:43 -0400 Subject: [PATCH 4/6] Update Dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ef1a696b22..dffb198e29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN dotnet publish ./ACE.Server/ACE.Server.csproj -a $TARGETARCH -c release -o / # final stage/image FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy ARG DEBIAN_FRONTEND="noninteractive" -WORKDIR /ace +WORKDIR /home/app/ace # install net-tools (netstat for health check) & cleanup RUN apt-get update && \ @@ -37,6 +37,8 @@ RUN apt-get update && \ # add app from build COPY --from=build /ace . +RUN chown -R app:app /home/app/ace/ +USER app ENTRYPOINT ["dotnet", "ACE.Server.dll"] # ports and volumes From 6b5ee05f396a04bfd70b005cc14f22a13d53e44b Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Wed, 24 Apr 2024 17:44:37 -0400 Subject: [PATCH 5/6] Update docker-compose.arm64 --- docker-compose.arm64 | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.arm64 b/docker-compose.arm64 index 7690e02085..2749edad9c 100644 --- a/docker-compose.arm64 +++ b/docker-compose.arm64 @@ -24,6 +24,7 @@ services: context: . dockerfile: Dockerfile.arm64 image: acemulator/ace:latest-arm64 + depends_on: ace-db: condition: service_healthy container_name: ace-server From 90eecfc74bf626a07d8a5509e7751046ea57687a Mon Sep 17 00:00:00 2001 From: Ty Conner Date: Wed, 24 Apr 2024 18:09:12 -0400 Subject: [PATCH 6/6] Update Dockerfile --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index dffb198e29..21b48f8563 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,11 @@ RUN apt-get update && \ # add app from build COPY --from=build /ace . + +# set correct permissions for app directory and files RUN chown -R app:app /home/app/ace/ + +# switch to and run app from non-root user USER app ENTRYPOINT ["dotnet", "ACE.Server.dll"]