Upgrade .net (#45)

This commit is contained in:
Gervasio Marchand 2023-12-15 08:50:42 -03:00 committed by GitHub
parent fe7703bd9f
commit 5919c3bc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -19,7 +19,7 @@ jobs:
shell: pwsh shell: pwsh
run: | run: |
$srcPath = Join-Path (Pwd) src $srcPath = Join-Path (Pwd) src
docker run -v "$($srcPath):/var/src" mcr.microsoft.com/dotnet/sdk:6.0.405-alpine3.16 ash -c "dotnet publish -r ${{ matrix.runtime }} --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -c Release /var/src/GetMoarFediverse.csproj -o /var/output" docker run -v "$($srcPath):/var/src" mcr.microsoft.com/dotnet/sdk:8.0.100-1-alpine3.18 ash -c "dotnet publish -r ${{ matrix.runtime }} --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -c Release /var/src/GetMoarFediverse.csproj -o /var/output"
build-docker: build-docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -35,5 +35,6 @@ jobs:
if ('${{ matrix.architecture }}' -eq 'arm64v8') { if ('${{ matrix.architecture }}' -eq 'arm64v8') {
sudo apt-get install qemu binfmt-support qemu-user-static sudo apt-get install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 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 }}

View File

@ -26,7 +26,7 @@ jobs:
$uid = sh -c 'id -u' $uid = sh -c 'id -u'
$gid = sh -c 'id -g' $gid = sh -c 'id -g'
docker run -v "$($outputPath):/var/output" -v "$($srcPath):/var/src" mcr.microsoft.com/dotnet/sdk:6.0.405-alpine3.16 ash -c "dotnet publish -r ${{ matrix.runtime }} --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -c Release /var/src/GetMoarFediverse.csproj -o /var/output && chown -R $($uid):$($gid) /var/output" docker run -v "$($outputPath):/var/output" -v "$($srcPath):/var/src" mcr.microsoft.com/dotnet/sdk:8.0.100-1-alpine3.18 ash -c "dotnet publish -r ${{ matrix.runtime }} --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -c Release /var/src/GetMoarFediverse.csproj -o /var/output && chown -R $($uid):$($gid) /var/output"
Push-Location $outputPath Push-Location $outputPath
chmod +r * chmod +r *
@ -98,6 +98,7 @@ jobs:
if ('${{ matrix.architecture }}' -eq 'arm64v8') { if ('${{ matrix.architecture }}' -eq 'arm64v8') {
sudo apt-get install qemu binfmt-support qemu-user-static sudo apt-get install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 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 . -t ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} --build-arg ARCH=${{ matrix.architecture }} docker build . -t ghcr.io/g3rv4/getmoarfediverse:latest-${{ matrix.architecture }} --build-arg ARCH=${{ matrix.architecture }}

View File

@ -1,12 +1,12 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG ARCH= ARG ARCH=
FROM mcr.microsoft.com/dotnet/sdk:6.0.405-alpine3.16-${ARCH} AS builder FROM mcr.microsoft.com/dotnet/sdk:8.0.100-1-alpine3.18-${ARCH} AS builder
WORKDIR /src WORKDIR /src
COPY src /src/ COPY src /src/
RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app RUN dotnet publish -c Release /src/GetMoarFediverse.csproj -o /app
FROM mcr.microsoft.com/dotnet/aspnet:6.0.13-alpine3.16-${ARCH} FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-alpine3.18-${ARCH}
VOLUME ["/data"] VOLUME ["/data"]
ENV CONFIG_PATH=/data/config.json ENV CONFIG_PATH=/data/config.json
COPY --from=builder /app /app COPY --from=builder /app /app

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>