2024-12-23 00:51:58 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
2022-04-10 10:57:51 -04:00
|
|
|
|
2019-08-12 06:49:18 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2025-10-08 21:00:51 +00:00
|
|
|
RUN apt-get update && apt-get install -y curl build-essential && \
|
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
|
|
|
|
|
|
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
|
|
|
ENV RUSTFLAGS='-C link-arg=-s'
|
|
|
|
|
|
|
|
|
|
# Install uniffi-bindgen-cs
|
|
|
|
|
RUN cargo install uniffi-bindgen-cs --git https://github.com/90-008/uniffi-bindgen-cs
|
|
|
|
|
|
2020-08-25 20:37:31 +02:00
|
|
|
# Restore/fetch dependencies excluding app code to make use of caching
|
2021-09-27 18:11:31 -04:00
|
|
|
COPY PluralKit.sln /app/
|
2021-03-03 23:27:54 +01:00
|
|
|
COPY Myriad/Myriad.csproj /app/Myriad/
|
2020-08-25 20:37:31 +02:00
|
|
|
COPY PluralKit.API/PluralKit.API.csproj /app/PluralKit.API/
|
|
|
|
|
COPY PluralKit.Bot/PluralKit.Bot.csproj /app/PluralKit.Bot/
|
|
|
|
|
COPY PluralKit.Core/PluralKit.Core.csproj /app/PluralKit.Core/
|
|
|
|
|
COPY PluralKit.Tests/PluralKit.Tests.csproj /app/PluralKit.Tests/
|
2021-08-01 15:22:23 -04:00
|
|
|
COPY .git/ /app/.git
|
2025-05-18 13:19:20 +00:00
|
|
|
COPY Serilog/ /app/Serilog/
|
2020-08-25 20:37:31 +02:00
|
|
|
RUN dotnet restore PluralKit.sln
|
|
|
|
|
|
2025-10-08 21:00:51 +00:00
|
|
|
# Copy the rest of the code
|
2020-08-25 20:37:31 +02:00
|
|
|
COPY . /app
|
2025-10-08 21:00:51 +00:00
|
|
|
|
|
|
|
|
# copy parser code
|
|
|
|
|
COPY Cargo.toml /app/
|
|
|
|
|
COPY Cargo.lock /app/
|
|
|
|
|
|
|
|
|
|
COPY crates/ /app/crates
|
|
|
|
|
|
|
|
|
|
# Generate command parser bindings
|
2025-10-08 21:50:58 +00:00
|
|
|
RUN mkdir -p /app/bin && cargo -Z unstable-options build --package commands --lib --release --artifact-dir /app/bin/
|
|
|
|
|
RUN uniffi-bindgen-cs "/app/bin/libcommands.so" --library --out-dir="/app/PluralKit.Bot"
|
|
|
|
|
RUN cargo run --package commands --bin write_cs_glue -- "/app/PluralKit.Bot/commandtypes.cs"
|
2025-10-08 21:00:51 +00:00
|
|
|
|
|
|
|
|
# build bot
|
2020-08-25 20:37:31 +02:00
|
|
|
RUN dotnet build -c Release -o bin
|
2019-08-12 06:49:18 +02:00
|
|
|
|
2021-06-09 12:47:26 +02:00
|
|
|
# Build runtime stage (doesn't include SDK)
|
2024-12-23 00:51:58 +00:00
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
2022-06-05 12:57:10 -04:00
|
|
|
LABEL org.opencontainers.image.source = "https://github.com/PluralKit/PluralKit"
|
2021-06-09 12:55:38 +02:00
|
|
|
|
2021-06-09 12:47:26 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY --from=build /app ./
|
|
|
|
|
|
2020-08-25 20:37:31 +02:00
|
|
|
# Allow overriding CMD from eg. docker-compose to run API layer too
|
|
|
|
|
ENTRYPOINT ["dotnet"]
|
2021-09-27 18:11:31 -04:00
|
|
|
CMD ["bin/PluralKit.Bot.dll"]
|