mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-21 23:23:09 +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
|
- name: Build things
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
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 }}
|
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:
|
create-docker-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ create-release ]
|
needs: [ create-release ]
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
architecture: [ amd64, arm64v8 ]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -94,19 +91,23 @@ jobs:
|
|||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$version = '${{ github.event.ref }}'.Replace('refs/tags/', '').Replace('v', '')
|
$version = '${{ github.event.ref }}'.Replace('refs/tags/', '').Replace('v', '')
|
||||||
|
$packageUrl = "ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}".ToLower()
|
||||||
|
|
||||||
if ('${{ matrix.architecture }}' -eq 'arm64v8') {
|
$archs = "amd64", "arm64v8"
|
||||||
sudo apt-get install qemu binfmt-support qemu-user-static
|
foreach ($arch in $archs) {
|
||||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
docker build -t "$($packageUrl):latest-$($arch)" --build-arg ARCH=$($arch) .
|
||||||
sed -i 's/8.0.100-1-alpine3.18/8.0.100-alpine3.18/' Dockerfile
|
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 manifest create `
|
||||||
docker tag ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} ghcr.io/g3rv4/getmoarfediverse:$version-${{ matrix.architecture }}
|
"$($packageUrl):latest" `
|
||||||
docker push ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }}
|
--amend "$($packageUrl):latest-amd64" `
|
||||||
docker push ghcr.io/g3rv4/getmoarfediverse:$version-${{ matrix.architecture }}
|
--amend "$($packageUrl):latest-arm64v8"
|
||||||
|
docker manifest create `
|
||||||
if ('${{ matrix.architecture }}' -eq 'amd64') {
|
"$($packageUrl):$($version)" `
|
||||||
docker tag ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} ghcr.io/g3rv4/getmoarfediverse:latest
|
--amend "$($packageUrl):$($version)-amd64" `
|
||||||
docker push ghcr.io/g3rv4/getmoarfediverse:latest
|
--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=
|
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
|
WORKDIR /src
|
||||||
COPY src /src/
|
COPY src /src/
|
||||||
RUN dotnet restore /src/GetMoarFediverse.csproj --disable-parallel
|
RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app
|
||||||
RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app --no-restore
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-alpine3.18-${ARCH}
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-alpine3.18-${ARCH}
|
||||||
VOLUME ["/data"]
|
WORKDIR /app
|
||||||
ENV CONFIG_PATH=/data/config.json
|
ENV CONFIG_PATH=/data/config.json
|
||||||
COPY --from=builder /app /app
|
COPY --from=builder /app /app
|
||||||
CMD ["/app/GetMoarFediverse"]
|
CMD /usr/bin/dotnet GetMoarFediverse.dll
|
||||||
|
Loading…
Reference in New Issue
Block a user