Files
Rafał Tyński a9815b54e0 fix(infra): fix Dockerfile restore and build script solution name
Copy the layered project files before restore so the Docker build resolves project references, and build the correct solution file (TarninaHub.slnx) in scripts/build.mjs.
2026-10-04 01:50:01 +02:00

50 lines
1.5 KiB
Docker

# syntax=docker/dockerfile:1
# --- Stage 1: build klienta (Vue 3 + Vite) ---
FROM node:22-alpine AS client
WORKDIR /src/client
COPY client/package.json client/package-lock.json ./
RUN npm ci
COPY client/ ./
RUN npm run build
# --- Stage 2: build i publish backendu (ASP.NET Core, .NET 10) ---
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY backend/TarninaHub.csproj ./backend/
COPY backend/Domain/TarninaHub.Domain.csproj ./backend/Domain/
COPY backend/Application/TarninaHub.Application.csproj ./backend/Application/
COPY backend/Infrastructure/TarninaHub.Infrastructure.csproj ./backend/Infrastructure/
RUN dotnet restore ./backend/TarninaHub.csproj
COPY backend/ ./backend/
COPY --from=client /src/client/dist ./backend/wwwroot/
RUN dotnet publish ./backend/TarninaHub.csproj \
--configuration Release \
--output /app/publish \
/p:UseAppHost=false
# --- Stage 3: runtime ---
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
ARG APP_VERSION=0.0.1
LABEL org.opencontainers.image.title="TarninaHub" \
org.opencontainers.image.version="${APP_VERSION}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
ENV ASPNETCORE_ENVIRONMENT=Production \
ASPNETCORE_URLS=http://+:8080 \
DOTNET_EnableDiagnostics=0
COPY --from=build /app/publish ./
# Jedyny wolumen aplikacji: trwałe dane SurrealDB (embedded RocksDB).
RUN mkdir -p /app/data
VOLUME ["/app/data"]
EXPOSE 8080
ENTRYPOINT ["dotnet", "TarninaHub.dll"]