26 lines
920 B
Docker
26 lines
920 B
Docker
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS builder
|
|
ARG TARGETARCH
|
|
WORKDIR /src
|
|
|
|
# copy csproj/fsproj & nuget config, then restore as distinct layers
|
|
COPY NuGet.Config /src
|
|
COPY Iceshrimp.Backend/*.csproj /src/Iceshrimp.Backend/
|
|
COPY Iceshrimp.Parsing/*.fsproj /src/Iceshrimp.Parsing/
|
|
COPY Iceshrimp.Frontend/*.csproj /src/Iceshrimp.Frontend/
|
|
COPY Iceshrimp.Shared/*.csproj /src/Iceshrimp.Shared/
|
|
WORKDIR /src/Iceshrimp.Backend
|
|
RUN dotnet restore -a $TARGETARCH
|
|
|
|
# copy build files
|
|
COPY . /src/
|
|
|
|
# build
|
|
RUN dotnet publish --no-restore -a $TARGETARCH -o /app
|
|
|
|
# Enable globalization and time zones:
|
|
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
|
|
# final stage/image
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine-composite
|
|
WORKDIR /app
|
|
COPY --from=builder /app .
|
|
ENTRYPOINT ["./Iceshrimp.Backend", "--environment", "Production", "--migrate-and-start"]
|