Add a multi-stage Dockerfile (Vue build + .NET 10 publish) and a docker-compose service exposing port 8080 with a single bind mount ./data -> /app/data for SurrealDB persistence. Include an example compose file, a .dockerignore, and document Docker usage and version 0.0.1 in the README.
47 lines
1.3 KiB
Docker
47 lines
1.3 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/
|
|
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"]
|