Switch to an alpine container and single file, self-contained deployments

This commit is contained in:
Daan Boerlage 2021-03-19 01:10:22 +01:00
parent 1c64328587
commit f25c9250ec
Signed by: daan
GPG key ID: FCE070E1E4956606
6 changed files with 6 additions and 3 deletions

View file

@ -18,7 +18,7 @@ Build:
script: script:
- dotnet restore - dotnet restore
- dotnet test tests - dotnet test tests
- dotnet publish --version-suffix "$VERSION" -r linux-x64 -c Release -o ./app ./src/Bot/ - dotnet publish --version-suffix "$VERSION" -r linux-musl-x64 -p:PublishSingleFile=true --self-contained true -c Release -o ./app ./src/Bot/
Package: Package:
stage: docker stage: docker

View file

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
COPY ./app /app/ COPY ./app /app/

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win10-x64;linux-x64;linux-musl-x64</RuntimeIdentifiers>
<ApplicationIcon>derp.ico</ApplicationIcon> <ApplicationIcon>derp.ico</ApplicationIcon>
<VersionSuffix>$(VersionSuffix)</VersionSuffix> <VersionSuffix>$(VersionSuffix)</VersionSuffix>
<RootNamespace>Geekbot.Bot</RootNamespace> <RootNamespace>Geekbot.Bot</RootNamespace>

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>win10-x64;linux-x64;linux-musl-x64</RuntimeIdentifiers>
<VersionSuffix>$(VersionSuffix)</VersionSuffix> <VersionSuffix>$(VersionSuffix)</VersionSuffix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionSuffix)</Version> <Version Condition=" '$(VersionSuffix)' != '' ">$(VersionSuffix)</Version>
<Version Condition=" '$(VersionSuffix)' == '' ">0.0.0-DEV</Version> <Version Condition=" '$(VersionSuffix)' == '' ">0.0.0-DEV</Version>

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>win10-x64;linux-x64;linux-musl-x64</RuntimeIdentifiers>
<VersionSuffix>$(VersionSuffix)</VersionSuffix> <VersionSuffix>$(VersionSuffix)</VersionSuffix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionSuffix)</Version> <Version Condition=" '$(VersionSuffix)' != '' ">$(VersionSuffix)</Version>
<Version Condition=" '$(VersionSuffix)' == '' ">0.0.0-DEV</Version> <Version Condition=" '$(VersionSuffix)' == '' ">0.0.0-DEV</Version>

View file

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>win10-x64;linux-x64;linux-musl-x64</RuntimeIdentifiers>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<NoWarn>NU1701</NoWarn> <NoWarn>NU1701</NoWarn>
<NoWarn>xUnit1026</NoWarn> <NoWarn>xUnit1026</NoWarn>