Compare commits

...

1 Commits

Author SHA1 Message Date
f5313b3362 feat(CUB-65): add multi-stage Dockerfile and .dockerignore for backend
Some checks failed
Dev Build / build-test (pull_request) Failing after 58s
Dev Build / deploy-dev (pull_request) Has been skipped
Dev Build / notify-success (pull_request) Has been skipped
Dev Build / notify-failure (pull_request) Successful in 4s
2026-04-26 21:05:54 +00:00
2 changed files with 57 additions and 0 deletions

27
backend/.dockerignore Normal file
View File

@@ -0,0 +1,27 @@
# Build artifacts
bin/
obj/
# IDE / editor
.vs/
.vscode/
*.user
*.suo
.idea/
# Environment & secrets
appsettings.Development.json
.env
.env.*
# Docker
Dockerfile
.dockerignore
# OS
.DS_Store
Thumbs.db
# Misc
*.md
*.log

30
backend/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# ── Stage 1: Build ──────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copy csproj first for layer caching — restores before copying source
COPY Extrudex.csproj .
RUN dotnet restore
# Copy the rest of the source
COPY . .
RUN dotnet publish Extrudex.csproj \
-c Release \
-o /app/publish \
--no-restore
# ── Stage 2: Runtime ────────────────────────────────────────
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
# Non-root user for security
RUN adduser --disabled-password --gecos "" appuser
USER appuser
# Copy published output from build stage
COPY --from=build /app/publish .
# ASP.NET Core listens on 8080 by default in .NET 8+
EXPOSE 8080
ENTRYPOINT ["dotnet", "Extrudex.dll"]