From b970b2f5931daa68fce43da47ae950d3465571ea Mon Sep 17 00:00:00 2001 From: Oleksandr Bezdieniezhnykh Date: Mon, 6 Apr 2026 04:59:49 +0300 Subject: [PATCH] Update Dockerfile for multi-platform support and enhance nginx registry script with volume and environment variable configurations --- .cursor/rules/coderule.mdc | 1 + .cursor/rules/python.mdc | 1 - Dockerfile | 7 ++++--- env/api/02-nginx-docker-registry.sh | 5 ++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.cursor/rules/coderule.mdc b/.cursor/rules/coderule.mdc index af70783..a90389d 100644 --- a/.cursor/rules/coderule.mdc +++ b/.cursor/rules/coderule.mdc @@ -21,3 +21,4 @@ alwaysApply: true - Make sure we don't commit binaries, create and keep .gitignore up to date and delete binaries after you are done with the task - Never force-push to main or dev branches +- Place all source code under the `src/` directory; keep project-level config, tests, and tooling at the repo root diff --git a/.cursor/rules/python.mdc b/.cursor/rules/python.mdc index fc8e934..95d0628 100644 --- a/.cursor/rules/python.mdc +++ b/.cursor/rules/python.mdc @@ -8,7 +8,6 @@ globs: ["**/*.py", "**/pyproject.toml", "**/requirements*.txt"] - Use type hints on all function signatures; validate with `mypy` or `pyright` - Use `pydantic` for data validation and serialization - Import order: stdlib -> third-party -> local; use absolute imports -- Use `src/` layout to separate app code from project files - Use context managers (`with`) for resource management - Catch specific exceptions, never bare `except:`; use custom exception classes - Use `async`/`await` with `asyncio` for I/O-bound concurrency diff --git a/Dockerfile b/Dockerfile index 8b3e2da..ff66332 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base WORKDIR /app EXPOSE 8080 -# Build whole app -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG TARGETARCH WORKDIR /app COPY . . @@ -13,7 +13,8 @@ WORKDIR "/app/Azaion.AdminApi" RUN dotnet build "Azaion.AdminApi.csproj" -c Release -o /app/build FROM build AS publish -RUN dotnet publish "Azaion.AdminApi.csproj" -c Release -o /app/publish /p:UseAppHost=false +RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \ + dotnet publish "Azaion.AdminApi.csproj" -c Release -o /app/publish /p:UseAppHost=false --os linux --arch $arch # Build runtime FROM base AS final diff --git a/env/api/02-nginx-docker-registry.sh b/env/api/02-nginx-docker-registry.sh index 9cad26d..49388c9 100644 --- a/env/api/02-nginx-docker-registry.sh +++ b/env/api/02-nginx-docker-registry.sh @@ -1,7 +1,10 @@ #!/bin/sh apt install -y docker.io apache2-utils certbot python3-certbot-nginx nginx -docker run -d -p 5000:5000 --name registry --restart always registry:latest +docker run -d -p 5000:5000 --name registry --restart always \ + -v registry-data:/var/lib/registry \ + -e REGISTRY_STORAGE_DELETE_ENABLED=true \ + registry:latest # create user for docker auth cd /etc/nginx