lapis/Dockerfile
2023-10-29 13:09:47 +06:00

34 lines
989 B
Docker

# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers, build
COPY *.csproj ./
RUN dotnet restore
COPY ["appsettings.json", "Program.cs", "Controllers", "Data", "Models", "Properties", "Services", "Utilities", "./"]
# --build-arg VCS_DESCRIBE=$(git describe --long --always --dirty --exclude\* --abbrev=8)
ARG VCS_DESCRIBE
RUN dotnet publish -c Release --os linux-musl -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true -o out
FROM node:current-alpine3.15 AS frontend-build-env
WORKDIR /app/Web
COPY ["Web/package.json", "Web/package-lock.json", "./"]
RUN npm ci
COPY ["Web", "./"]
ARG VCS_DESCRIBE
RUN npx vite build --emptyOutDir --outDir ../wwwroot
WORKDIR /app
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine
WORKDIR /app
COPY --from=build-env /app/out/ ./
COPY --from=frontend-build-env /app/wwwroot/ ./wwwroot/
EXPOSE 7049
ENTRYPOINT ["./lapis"]