mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-21 07:03:08 +01:00
Build: Improve speed and build a manifest for both architectures (#49)
This commit is contained in:
parent
cbc49531ad
commit
91a2e5ebae
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@ -32,9 +32,4 @@ jobs:
|
||||
- name: Build things
|
||||
shell: pwsh
|
||||
run: |
|
||||
if ('${{ matrix.architecture }}' -eq 'arm64v8') {
|
||||
sudo apt-get install qemu binfmt-support qemu-user-static
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
sed -i 's/8.0.100-1-alpine3.18/8.0.100-alpine3.18/' Dockerfile
|
||||
}
|
||||
docker build . --build-arg ARCH=${{ matrix.architecture }}
|
||||
|
33
.github/workflows/create-release.yml
vendored
33
.github/workflows/create-release.yml
vendored
@ -78,9 +78,6 @@ jobs:
|
||||
create-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ create-release ]
|
||||
strategy:
|
||||
matrix:
|
||||
architecture: [ amd64, arm64v8 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@ -94,19 +91,23 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
$version = '${{ github.event.ref }}'.Replace('refs/tags/', '').Replace('v', '')
|
||||
$packageUrl = "ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}".ToLower()
|
||||
|
||||
if ('${{ matrix.architecture }}' -eq 'arm64v8') {
|
||||
sudo apt-get install qemu binfmt-support qemu-user-static
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
sed -i 's/8.0.100-1-alpine3.18/8.0.100-alpine3.18/' Dockerfile
|
||||
$archs = "amd64", "arm64v8"
|
||||
foreach ($arch in $archs) {
|
||||
docker build -t "$($packageUrl):latest-$($arch)" --build-arg ARCH=$($arch) .
|
||||
docker tag "$($packageUrl):latest-$($arch)" "$($packageUrl):$($version)-$($arch)"
|
||||
docker push "$($packageUrl):latest-$($arch)"
|
||||
docker push "$($packageUrl):$($version)-$($arch)"
|
||||
}
|
||||
|
||||
docker build . -t ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} --build-arg ARCH=${{ matrix.architecture }}
|
||||
docker tag ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} ghcr.io/g3rv4/getmoarfediverse:$version-${{ matrix.architecture }}
|
||||
docker push ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }}
|
||||
docker push ghcr.io/g3rv4/getmoarfediverse:$version-${{ matrix.architecture }}
|
||||
|
||||
if ('${{ matrix.architecture }}' -eq 'amd64') {
|
||||
docker tag ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} ghcr.io/g3rv4/getmoarfediverse:latest
|
||||
docker push ghcr.io/g3rv4/getmoarfediverse:latest
|
||||
}
|
||||
docker manifest create `
|
||||
"$($packageUrl):latest" `
|
||||
--amend "$($packageUrl):latest-amd64" `
|
||||
--amend "$($packageUrl):latest-arm64v8"
|
||||
docker manifest create `
|
||||
"$($packageUrl):$($version)" `
|
||||
--amend "$($packageUrl):$($version)-amd64" `
|
||||
--amend "$($packageUrl):$($version)-arm64v8"
|
||||
docker manifest push "$($packageUrl):latest"
|
||||
docker manifest push "$($packageUrl):$($version)"
|
||||
|
11
Dockerfile
11
Dockerfile
@ -1,14 +1,11 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG ARCH=
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0.100-1-alpine3.18-${ARCH} AS builder
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0.100-1-alpine3.18 AS builder
|
||||
WORKDIR /src
|
||||
COPY src /src/
|
||||
RUN dotnet restore /src/GetMoarFediverse.csproj --disable-parallel
|
||||
RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app --no-restore
|
||||
RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-alpine3.18-${ARCH}
|
||||
VOLUME ["/data"]
|
||||
WORKDIR /app
|
||||
ENV CONFIG_PATH=/data/config.json
|
||||
COPY --from=builder /app /app
|
||||
CMD ["/app/GetMoarFediverse"]
|
||||
CMD /usr/bin/dotnet GetMoarFediverse.dll
|
||||
|
Loading…
Reference in New Issue
Block a user