Dockerfile
· 1.5 KiB · Docker
Raw
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 5000
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG TARGETARCH
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["WeddingShare/WeddingShare.csproj", "WeddingShare/"]
RUN dotnet restore -a $TARGETARCH "./WeddingShare/./WeddingShare.csproj"
COPY . .
WORKDIR "/src/WeddingShare"
RUN dotnet build "./WeddingShare.csproj" -a $TARGETARCH -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./WeddingShare.csproj" -a $TARGETARCH -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM debian:12 as ffmpeg
RUN apt update
RUN apt install -y wget unzip
WORKDIR /ffmpeg
# Replace these links with the arm ones from the link above
RUN wget https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v6.1/ffmpeg-6.1-linux-arm-64.zip
RUN wget https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v6.1/ffprobe-6.1-linux-arm-64.zip
RUN unzip ffmpeg-6.1-linux-arm-64.zip
RUN unzip ffprobe-6.1-linux-arm-64.zip
FROM base AS final
WORKDIR /ffmpeg
COPY --from=ffmpeg /ffmpeg/ffmpeg .
COPY --from=ffmpeg /ffmpeg/ffprobe .
COPY --from=ffmpeg /ffmpeg/ffmpeg /usr/local/bin/ffmpeg
COPY --from=ffmpeg /ffmpeg/ffprobe /usr/local/bin/ffprobe
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WeddingShare.dll"]
| 1 | #See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. |
| 2 | |
| 3 | FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base |
| 4 | WORKDIR /app |
| 5 | EXPOSE 5000 |
| 6 | |
| 7 | FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build |
| 8 | ARG TARGETARCH |
| 9 | ARG BUILD_CONFIGURATION=Release |
| 10 | WORKDIR /src |
| 11 | COPY ["WeddingShare/WeddingShare.csproj", "WeddingShare/"] |
| 12 | RUN dotnet restore -a $TARGETARCH "./WeddingShare/./WeddingShare.csproj" |
| 13 | COPY . . |
| 14 | WORKDIR "/src/WeddingShare" |
| 15 | RUN dotnet build "./WeddingShare.csproj" -a $TARGETARCH -c $BUILD_CONFIGURATION -o /app/build |
| 16 | |
| 17 | FROM build AS publish |
| 18 | ARG BUILD_CONFIGURATION=Release |
| 19 | RUN dotnet publish "./WeddingShare.csproj" -a $TARGETARCH -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false |
| 20 | |
| 21 | FROM debian:12 as ffmpeg |
| 22 | RUN apt update |
| 23 | RUN apt install -y wget unzip |
| 24 | WORKDIR /ffmpeg |
| 25 | # Replace these links with the arm ones from the link above |
| 26 | RUN wget https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v6.1/ffmpeg-6.1-linux-arm-64.zip |
| 27 | RUN wget https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v6.1/ffprobe-6.1-linux-arm-64.zip |
| 28 | RUN unzip ffmpeg-6.1-linux-arm-64.zip |
| 29 | RUN unzip ffprobe-6.1-linux-arm-64.zip |
| 30 | |
| 31 | FROM base AS final |
| 32 | WORKDIR /ffmpeg |
| 33 | COPY --from=ffmpeg /ffmpeg/ffmpeg . |
| 34 | COPY --from=ffmpeg /ffmpeg/ffprobe . |
| 35 | COPY --from=ffmpeg /ffmpeg/ffmpeg /usr/local/bin/ffmpeg |
| 36 | COPY --from=ffmpeg /ffmpeg/ffprobe /usr/local/bin/ffprobe |
| 37 | WORKDIR /app |
| 38 | COPY --from=publish /app/publish . |
| 39 | ENTRYPOINT ["dotnet", "WeddingShare.dll"] |
| 40 |