Update Dockerfile for multi-platform support and enhance nginx registry script with volume and environment variable configurations

This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-06 04:59:49 +03:00
parent ce44d565c8
commit b970b2f593
4 changed files with 9 additions and 5 deletions
+1
View File
@@ -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 - 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 - 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
-1
View File
@@ -8,7 +8,6 @@ globs: ["**/*.py", "**/pyproject.toml", "**/requirements*.txt"]
- Use type hints on all function signatures; validate with `mypy` or `pyright` - Use type hints on all function signatures; validate with `mypy` or `pyright`
- Use `pydantic` for data validation and serialization - Use `pydantic` for data validation and serialization
- Import order: stdlib -> third-party -> local; use absolute imports - 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 - Use context managers (`with`) for resource management
- Catch specific exceptions, never bare `except:`; use custom exception classes - Catch specific exceptions, never bare `except:`; use custom exception classes
- Use `async`/`await` with `asyncio` for I/O-bound concurrency - Use `async`/`await` with `asyncio` for I/O-bound concurrency
+4 -3
View File
@@ -2,8 +2,8 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
# Build whole app FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG TARGETARCH
WORKDIR /app WORKDIR /app
COPY . . COPY . .
@@ -13,7 +13,8 @@ WORKDIR "/app/Azaion.AdminApi"
RUN dotnet build "Azaion.AdminApi.csproj" -c Release -o /app/build RUN dotnet build "Azaion.AdminApi.csproj" -c Release -o /app/build
FROM build AS publish 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 # Build runtime
FROM base AS final FROM base AS final
+4 -1
View File
@@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
apt install -y docker.io apache2-utils certbot python3-certbot-nginx nginx 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 # create user for docker auth
cd /etc/nginx cd /etc/nginx