Skip to content

Commit 7312360

Browse files
Wannes GennarWannes Gennar
authored andcommitted
chore: update docker build
1 parent 7754a46 commit 7312360

4 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,22 @@ jobs:
3636
retention-days: 5
3737
name: openapi-schemas
3838
path: docs/openapi/
39+
40+
docker-build:
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
submodules: true
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
- name: Build Docker image
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
file: ./src/Helldivers-2-API/Dockerfile
54+
push: false
55+
tags: helldivers-api:test
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

src/Helldivers-2-API/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine-extra AS base
1+
FROM alpine:latest AS base
22
USER $APP_UID
33
WORKDIR /app
44

5-
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
5+
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine-aot AS build
66
RUN apk add --upgrade --no-cache build-base clang zlib-dev
77
ARG BUILD_CONFIGURATION=Release
88
ARG BUILD_RUNTIME=linux-musl-x64
@@ -35,6 +35,8 @@ RUN dotnet build "Helldivers-2-API.csproj" --no-restore -r $BUILD_RUNTIME -c $BU
3535

3636
FROM build AS publish
3737
ARG BUILD_CONFIGURATION=Release
38+
ARG BUILD_RUNTIME=linux-musl-x64
39+
ARG VERSION=0.0.0
3840
RUN dotnet publish "Helldivers-2-API.csproj" /p:Version="$VERSION" --no-restore --self-contained -r $BUILD_RUNTIME -c $BUILD_CONFIGURATION -o /app/publish
3941

4042
FROM base AS final

src/Helldivers-2-API/Helldivers-2-API.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<RootNamespace>Helldivers.API</RootNamespace>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
8+
<PublishReadyToRun>true</PublishReadyToRun>
89
</PropertyGroup>
910

1011
<!-- Only generate OpenAPI docs for DEBUG builds -->

src/Helldivers-2-API/OpenApi/TypeMappers/EnumStringTypeMapper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using NJsonSchema;
1+
#if DEBUG
2+
using NJsonSchema;
23
using NJsonSchema.Generation.TypeMappers;
34
using System.Collections.ObjectModel;
45

@@ -34,3 +35,4 @@ public void GenerateSchema(JsonSchema schema, TypeMapperContext context)
3435
schema.ExtensionData ??= new Dictionary<string, object>()!;
3536
}
3637
}
38+
#endif

0 commit comments

Comments
 (0)