mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 02:00:09 +00:00
docker images?
This commit is contained in:
parent
77444bff2e
commit
323377c217
3 changed files with 43 additions and 21 deletions
20
.github/workflows/dotnet-docker.yml
vendored
20
.github/workflows/dotnet-docker.yml
vendored
|
|
@ -1,23 +1,23 @@
|
||||||
name: Build and push Docker image
|
name: Build and push Docker image
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '.dockerignore'
|
- ".dockerignore"
|
||||||
- '.github/workflows/dotnet-docker.yml'
|
- ".github/workflows/dotnet-docker.yml"
|
||||||
- 'ci/Dockerfile.dotnet'
|
- "ci/Dockerfile.dotnet"
|
||||||
- 'ci/dotnet-version.sh'
|
- "ci/dotnet-version.sh"
|
||||||
- 'Myriad/**'
|
- "Myriad/**"
|
||||||
- 'PluralKit.API/**'
|
- "PluralKit.API/**"
|
||||||
- 'PluralKit.Bot/**'
|
- "PluralKit.Bot/**"
|
||||||
- 'PluralKit.Core/**'
|
- "PluralKit.Core/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: '.net docker build'
|
name: ".net docker build"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
if: github.repository == 'PluralKit/PluralKit'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: docker/login-action@v1
|
- uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
20
.github/workflows/rust-docker.yml
vendored
20
.github/workflows/rust-docker.yml
vendored
|
|
@ -1,22 +1,22 @@
|
||||||
name: Build and push Rust service Docker images
|
name: Build and push Rust service Docker images
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'crates/**'
|
- "crates/**"
|
||||||
- '.dockerignore'
|
- ".dockerignore"
|
||||||
- '.github/workflows/rust.yml'
|
- ".github/workflows/rust.yml"
|
||||||
- 'ci/Dockerfile.rust'
|
- "ci/Dockerfile.rust"
|
||||||
- 'ci/rust-docker-target.sh'
|
- "ci/rust-docker-target.sh"
|
||||||
- 'Cargo.toml'
|
- "Cargo.toml"
|
||||||
- 'Cargo.lock'
|
- "Cargo.lock"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: 'rust docker build'
|
name: "rust docker build"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
if: github.repository == 'PluralKit/PluralKit'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: docker/login-action@v1
|
- uses: docker/login-action@v1
|
||||||
if: ${{ !env.ACT }}
|
if: ${{ !env.ACT }}
|
||||||
|
|
@ -35,7 +35,7 @@ jobs:
|
||||||
# https://github.com/docker/build-push-action/issues/378
|
# https://github.com/docker/build-push-action/issues/378
|
||||||
context: .
|
context: .
|
||||||
file: ci/Dockerfile.rust
|
file: ci/Dockerfile.rust
|
||||||
push: false
|
push: false
|
||||||
cache-from: type=registry,ref=ghcr.io/pluralkit/docker-cache:rust
|
cache-from: type=registry,ref=ghcr.io/pluralkit/docker-cache:rust
|
||||||
cache-to: type=registry,ref=ghcr.io/pluralkit/docker-cache:rust,mode=max
|
cache-to: type=registry,ref=ghcr.io/pluralkit/docker-cache:rust,mode=max
|
||||||
outputs: .docker-bin
|
outputs: .docker-bin
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,15 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
# Restore/fetch dependencies excluding app code to make use of caching
|
# Restore/fetch dependencies excluding app code to make use of caching
|
||||||
COPY PluralKit.sln /app/
|
COPY PluralKit.sln /app/
|
||||||
COPY Myriad/Myriad.csproj /app/Myriad/
|
COPY Myriad/Myriad.csproj /app/Myriad/
|
||||||
|
|
@ -13,8 +22,21 @@ COPY .git/ /app/.git
|
||||||
COPY Serilog/ /app/Serilog/
|
COPY Serilog/ /app/Serilog/
|
||||||
RUN dotnet restore PluralKit.sln
|
RUN dotnet restore PluralKit.sln
|
||||||
|
|
||||||
# Copy the rest of the code and build
|
# Copy the rest of the code
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
|
# copy parser code
|
||||||
|
COPY Cargo.toml /app/
|
||||||
|
COPY Cargo.lock /app/
|
||||||
|
|
||||||
|
COPY crates/ /app/crates
|
||||||
|
|
||||||
|
# Generate command parser bindings
|
||||||
|
RUN mkdir -p app/obj && cargo -Z unstable-options build --package commands --lib --release --artifact-dir app/obj/
|
||||||
|
RUN uniffi-bindgen-cs "app/obj/libcommands.so" --library --out-dir="app/PluralKit.Bot"
|
||||||
|
RUN cargo run --package commands --bin write_cs_glue -- "app/PluralKit.Bot/commandtypes.cs"
|
||||||
|
|
||||||
|
# build bot
|
||||||
RUN dotnet build -c Release -o bin
|
RUN dotnet build -c Release -o bin
|
||||||
|
|
||||||
# Build runtime stage (doesn't include SDK)
|
# Build runtime stage (doesn't include SDK)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue