[docker] Switch most docker images used in CI to the iceshrimp.dev repo

This commit is contained in:
Laura Hausmann 2024-07-03 00:08:37 +02:00
parent 70f822ab3d
commit 9e4ccabf87
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
11 changed files with 23 additions and 21 deletions

6
.docker/build.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
docker build . -f dotnet-sdk-8.0-wasm.Dockerfile -t iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-wasm --push
docker build . -f dotnet-sdk-8.0-alpine.Dockerfile -t iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-alpine --push
docker build . -f dotnet-sdk-9.0-alpine-wasm.Dockerfile -t iceshrimp.dev/iceshrimp/dotnet-sdk:9.0-alpine-wasm --push
docker build . -f ci-env.Dockerfile -t iceshrimp.dev/iceshrimp/ci-env:dotnet --push
docker build . -f ci-env-wasm.Dockerfile -t iceshrimp.dev/iceshrimp/ci-env:dotnet-wasm --push

View file

@ -1,11 +1,8 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
FROM iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-wasm
RUN apt-get update && apt-get install git bash python3 curl golang nodejs zstd ca-certificates -y
RUN install -m 0755 -d /etc/apt/keyrings
RUN curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
RUN chmod a+r /etc/apt/keyrings/docker.asc
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update && apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -y
RUN curl -o /bin/git-restore-mtime https://raw.githubusercontent.com/MestreLion/git-tools/main/git-restore-mtime
RUN chmod +x /bin/git-restore-mtime
RUN dotnet workload install wasm-tools
CMD ["/bin/sh"]

View file

@ -1,5 +1,3 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
RUN apk add --no-cache --no-progress git docker bash python3 curl go nodejs-current zstd
RUN curl -o /bin/git-restore-mtime https://raw.githubusercontent.com/MestreLion/git-tools/main/git-restore-mtime
RUN chmod +x /bin/git-restore-mtime
CMD ["/bin/sh"]

View file

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS image-aot
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled
ARG TARGETARCH
WORKDIR /app
COPY linux-$TARGETARCH/ .

View file

@ -0,0 +1,2 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
CMD ["/bin/sh"]

View file

@ -0,0 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0
RUN --mount=type=cache,target=/root/.nuget dotnet workload install wasm-tools
RUN apt-get update && apt-get install python3 -y
CMD ["/bin/sh"]

View file

@ -0,0 +1,2 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0-preview-alpine
RUN dotnet workload install wasm-tools

View file

@ -6,7 +6,7 @@ jobs:
test-build-and-push:
runs-on: docker
container:
image: iceshrimp.dev/iceshrimp/iceshrimp.net:ci-env
image: iceshrimp.dev/iceshrimp/ci-env:dotnet
options: |
--volume /opt/iceshrimp-cache/nuget:/root/.nuget
--volume /root/.docker:/root/.docker
@ -28,10 +28,7 @@ jobs:
- name: Initialize builder
run: docker buildx use iceshrimp-ci || docker buildx create --name iceshrimp-ci --use
- name: Patch Dockerfile
run: |
sed -i 's^mcr.microsoft.com/dotnet/sdk:8.0-alpine^iceshrimp.dev/iceshrimp/iceshrimp.net:ci-env^g' /iceshrimp/Dockerfile
sed -i 's^mcr.microsoft.com/dotnet/sdk:8.0^iceshrimp.dev/iceshrimp/iceshrimp.net:ci-env-wasm^g' /iceshrimp/Dockerfile
sed -i 's^dotnet workload install wasm-tools^echo^g' /iceshrimp/Dockerfile
run: sed -i 's^mcr.microsoft.com/dotnet/sdk:8.0-alpine^iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-alpine^g' /iceshrimp/Dockerfile
- name: Build the image
shell: bash
run: docker buildx build --target image-jit -t iceshrimp.dev/${GITHUB_REPOSITORY@L}:$GITHUB_REF_NAME --provenance=false --platform=linux/amd64,linux/arm64 --push /iceshrimp

View file

@ -6,7 +6,7 @@ jobs:
build-artifacts:
runs-on: docker
container:
image: iceshrimp.dev/iceshrimp/iceshrimp.net:ci-env-wasm
image: iceshrimp.dev/iceshrimp/ci-env:dotnet-wasm
options: --volume /opt/iceshrimp-cache/nuget:/root/.nuget
steps:
- name: Clone repository
@ -62,7 +62,7 @@ jobs:
- name: Build the image
shell: bash
run: |
cp /src/.forgejo/ci-release/Dockerfile /out
cp /src/.docker/dotnet-runner-8.0.Dockerfile /out/Dockerfile
docker buildx build ${{ env.TAGS }} --provenance=false --platform=linux/amd64,linux/arm64 --push /out
- name: Purge cache
run: docker buildx prune --keep-storage 20G

View file

@ -7,7 +7,7 @@ jobs:
test-build:
runs-on: docker
container:
image: iceshrimp.dev/iceshrimp/iceshrimp.net:ci-env
image: iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-alpine
options: --volume /opt/iceshrimp-cache/nuget:/root/.nuget
steps:
- name: Clone repository

View file

@ -3,7 +3,7 @@
# We have to build & run AOT images on linux-glibc, at least until .NET 9.0 (See https://github.com/dotnet/sdk/issues/32327 for details)
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS builder-jit
FROM --platform=$BUILDPLATFORM iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-alpine AS builder-jit
ARG BUILDPLATFORM
WORKDIR /src
@ -40,14 +40,10 @@ RUN --mount=type=cache,target=/root/.nuget \
mv /app-$TARGETARCH /app; else mv /build /app; \
fi
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS builder-aot
FROM --platform=$BUILDPLATFORM iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-wasm AS builder-aot
ARG BUILDPLATFORM
WORKDIR /src
RUN --mount=type=cache,target=/root/.nuget \
dotnet workload install wasm-tools
RUN apt-get update && apt-get install python3 -y
# copy csproj/fsproj & nuget config, then restore as distinct layers
COPY NuGet.Config /src
COPY Iceshrimp.Backend/*.csproj /src/Iceshrimp.Backend/