mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
+Docker
This commit is contained in:
66
Dockerfile
66
Dockerfile
@@ -1,23 +1,51 @@
|
||||
# PREREQUISITES
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
RUN apt update
|
||||
RUN apt install openssh-server nodejs npm -y
|
||||
|
||||
# CLONE & SETUP
|
||||
COPY . .
|
||||
RUN mkdir /data/
|
||||
RUN mkdir /data/hamann/
|
||||
RUN mkdir /data/xml/
|
||||
RUN git clone https://github.com/Theodor-Springmann-Stiftung/hamann-xml.git /data/xml/
|
||||
|
||||
# COMPILE & PUBLISH
|
||||
WORKDIR HaWeb/
|
||||
RUN dotnet restore
|
||||
# Build frontend assets
|
||||
FROM node:18 AS frontend
|
||||
WORKDIR /app/HaWeb
|
||||
COPY HaWeb/package*.json ./
|
||||
RUN npm install
|
||||
RUN npm run css_build
|
||||
RUN dotnet publish --no-restore -o /app
|
||||
COPY HaWeb/ ./
|
||||
RUN npm run build
|
||||
|
||||
# RUN
|
||||
# Build .NET application
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /app
|
||||
RUN DOTNET_ENVIRONMENT=Docker dotnet HaWeb.dll
|
||||
|
||||
# Copy project files and restore dependencies
|
||||
COPY HaDocumentV6/HaDocumentV6.csproj ./HaDocumentV6/
|
||||
COPY HaXMLReaderV6/HaXMLReaderV6.csproj ./HaXMLReaderV6/
|
||||
COPY HaWeb/HaWeb.csproj ./HaWeb/
|
||||
RUN dotnet restore HaWeb/HaWeb.csproj
|
||||
|
||||
# Copy all source files
|
||||
COPY HaDocumentV6/ ./HaDocumentV6/
|
||||
COPY HaXMLReaderV6/ ./HaXMLReaderV6/
|
||||
COPY HaWeb/ ./HaWeb/
|
||||
|
||||
# Copy built frontend assets (overwrites the source wwwroot/dist)
|
||||
COPY --from=frontend /app/HaWeb/wwwroot/dist/ ./HaWeb/wwwroot/dist/
|
||||
|
||||
# Build application
|
||||
WORKDIR /app/HaWeb
|
||||
RUN dotnet publish -c Release -o /app/publish
|
||||
|
||||
# Runtime image
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0
|
||||
WORKDIR /app
|
||||
|
||||
# Install git for LibGit2Sharp
|
||||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
# Create data directory
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# Expose ports for HTTP, HTTPS
|
||||
EXPOSE 5000
|
||||
EXPOSE 5001
|
||||
|
||||
ENV ASPNETCORE_URLS="http://+:5000;https://+:5001"
|
||||
ENV DOTNET_ENVIRONMENT="Production"
|
||||
ENV FileStoragePath="/app/data"
|
||||
|
||||
CMD ["dotnet", "HaWeb.dll"]
|
||||
Reference in New Issue
Block a user