Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
xBaank committed Jan 19, 2024
1 parent 4e0c77a commit 981adf4
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime:7.0 AS base
WORKDIR /app

RUN apt update
RUN apt install libsodium-dev -y
RUN apt install libopus-dev -y

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG TARGETARCH
WORKDIR /src
COPY ["DiscordBot/DiscordBot.csproj", "DiscordBot/"]
COPY ["DiscordBot.MusicPlayer/DiscordBot.MusicPlayer.csproj", "DiscordBot.MusicPlayer/"]
RUN dotnet restore "DiscordBot/DiscordBot.csproj" -a $TARGETARCH
COPY . .
WORKDIR "/src/DiscordBot"
RUN dotnet build "DiscordBot.csproj" -a $TARGETARCH -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "DiscordBot.csproj" -a $TARGETARCH --self-contained false -c Release -o /app/publish
RUN dotnet publish "DiscordBot.csproj" -a $TARGETARCH --self-contained false -c Release --no-restore -o /app/publish

FROM base AS final
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/runtime:7.0
RUN apt update
RUN apt install libsodium-dev -y
RUN apt install libopus-dev -y
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "DiscordBot.dll"]

0 comments on commit 981adf4

Please sign in to comment.