feat: Add initial deployment setup for OTSSignsOrchestrator
- Create index.html for the web application interface. - Implement deploy.sh script for building and deploying the application to a Docker Swarm manager. - Add docker-compose.yml for defining application and PostgreSQL service configurations.
This commit is contained in:
51
Dockerfile
Normal file
51
Dockerfile
Normal file
@@ -0,0 +1,51 @@
|
||||
# ── Stage 1: Build React frontend ────────────────────────────────────────────
|
||||
FROM node:20-alpine AS frontend-build
|
||||
WORKDIR /app/ClientApp
|
||||
COPY OTSSignsOrchestrator/ClientApp/package.json OTSSignsOrchestrator/ClientApp/package-lock.json* ./
|
||||
RUN npm ci
|
||||
COPY OTSSignsOrchestrator/ClientApp/ ./
|
||||
# Build outputs to ../wwwroot (relative to ClientApp)
|
||||
RUN npm run build
|
||||
|
||||
# ── Stage 2: Publish .NET app ─────────────────────────────────────────────────
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS dotnet-build
|
||||
WORKDIR /src
|
||||
|
||||
# Restore dependencies (layer-cached separately for fast rebuilds)
|
||||
COPY OTSSignsOrchestrator/OTSSignsOrchestrator.csproj OTSSignsOrchestrator/
|
||||
RUN dotnet restore OTSSignsOrchestrator/OTSSignsOrchestrator.csproj
|
||||
|
||||
# Copy source (excluding ClientApp — frontend handled in stage 1)
|
||||
COPY OTSSignsOrchestrator/ OTSSignsOrchestrator/
|
||||
|
||||
# Copy built frontend assets from stage 1
|
||||
COPY --from=frontend-build /app/wwwroot OTSSignsOrchestrator/wwwroot/
|
||||
|
||||
RUN dotnet publish OTSSignsOrchestrator/OTSSignsOrchestrator.csproj \
|
||||
-c Release \
|
||||
-o /app/publish \
|
||||
--no-restore
|
||||
|
||||
# ── Stage 3: Runtime image ────────────────────────────────────────────────────
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
# LibGit2Sharp requires git native libraries (libgit2 is bundled in the NuGet package,
|
||||
# but git2-ssh requires libssh2 on Linux)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libssl3 \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=dotnet-build /app/publish .
|
||||
|
||||
# Data Protection keys must survive restarts — mount a volume here
|
||||
VOLUME ["/app/dataprotection-keys"]
|
||||
|
||||
# Expose HTTP only — use a reverse proxy (nginx/Caddy/Traefik) for TLS termination
|
||||
EXPOSE 8080
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||
|
||||
ENTRYPOINT ["dotnet", "OTSSignsOrchestrator.dll"]
|
||||
Reference in New Issue
Block a user