Skip to content

Commit 87a80fb

Browse files
authored
Merge pull request #60 from PTCInc/dev-1.0
feat(sync): Updated docker/container support for .Net 10
2 parents 4087a43 + 7048836 commit 87a80fb

3 files changed

Lines changed: 33 additions & 24 deletions

File tree

.github/workflows/docker-build-and-push.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ name: Container Image
33
on:
44
workflow_dispatch:
55
workflow_run:
6-
branches: [ "main" ]
6+
branches: [ "main", "**" ]
77
workflows: ["Sync Service Build and Release"]
88
types:
99
- completed
10-
push:
11-
branches:
12-
- main
13-
paths:
14-
# - 'Kepware.Api/**'
15-
- 'KepwareSync.Service/**'
16-
# - '.github/workflows/docker-build-and-push.yml'
17-
- '!**/*.md' # Exclude markdown files
10+
# push:
11+
# branches:
12+
# - main
13+
# paths:
14+
# - 'Kepware.Api/**'
15+
# - 'KepwareSync.Service/**'
16+
# - '.github/workflows/docker-build-and-push.yml'
17+
# - '!**/*.md' Exclude markdown files
1818

1919
jobs:
2020
build:
@@ -50,7 +50,16 @@ jobs:
5050
id: lowercase
5151
run: echo "REPO_OWNER_LOWER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
5252

53+
- name: Build and export to Docker
54+
uses: docker/build-push-action@v6
55+
with:
56+
load: true
57+
tags: kepware-sync-service:test
58+
- name: Test
59+
run: |
60+
docker run --rm kepware-sync-service:test
5361
- name: Build and push Docker image
62+
if: ${{ github.event_name != 'pull_request'}}
5463
id: docker_build
5564
uses: docker/build-push-action@v4
5665
with:

KepwareSync.Service/Dockerfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Unter https://aka.ms/customizecontainer erfahren Sie, wie Sie Ihren Debugcontainer anpassen und wie Visual Studio dieses Dockerfile verwendet, um Ihre Images für ein schnelleres Debuggen zu erstellen.
1+
# Learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging at https://aka.ms/customizecontainer
22

3-
# Diese ARGs ermöglichen den Austausch der Basis, die zum Erstellen des endgültigen Images beim Debuggen von VS verwendet wird.
3+
# These ARGs allow switching the base used to create the final image when debugging from VS.
44
ARG LAUNCHING_FROM_VS
5-
# Hiermit wird das Basisimage für "final" festgelegt, jedoch nur, wenn LAUNCHING_FROM_VS definiert wurde.
5+
# This sets the base image for 'final', but only if LAUNCHING_FROM_VS is defined.
66
ARG FINAL_BASE_IMAGE=${LAUNCHING_FROM_VS:+aotdebug}
77

8-
# Diese Stufe wird verwendet, wenn sie von VS im Schnellmodus ausgeführt wird (Standardeinstellung für Debugkonfiguration).
9-
FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base
8+
# This stage is used when running from VS in Fast mode (Default for Debug configuration).
9+
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS base
1010
USER $APP_UID
1111
WORKDIR /app
1212

1313

14-
# Diese Stufe wird zum Erstellen des Dienstprojekts verwendet.
15-
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
16-
# Installieren Sie clang/zlib1g-dev-Abhängigkeiten für die Veröffentlichung unter nativ
14+
# This stage is used to build the service project.
15+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
16+
# Install clang/zlib1g-dev dependencies for native AOT publishing
1717
RUN apt-get update \
1818
&& apt-get install -y --no-install-recommends \
1919
clang zlib1g-dev
@@ -27,22 +27,22 @@ COPY . .
2727
WORKDIR "/src/KepwareSync.Service"
2828
RUN dotnet build "./Kepware.SyncService.csproj" -c $BUILD_CONFIGURATION -o /app/build
2929

30-
# Diese Stufe wird verwendet, um das Dienstprojekt zu veröffentlichen, das in die letzte Phase kopiert werden soll.
30+
# This stage is used to publish the service project to be copied to the final stage.
3131
FROM build AS publish
3232
ARG BUILD_CONFIGURATION=Release
3333
RUN dotnet publish "./Kepware.SyncService.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=true
3434

35-
# Diese Stufe wird als Basis für die letzte Stufe verwendet, wenn sie von VS gestartet wird, um das Debuggen im regulären Modus zu unterstützen (Standardwert, wenn die Debugkonfiguration nicht verwendet wird).
35+
# This stage is used as the base for the final stage when launched from VS to support debugging in regular mode (Default when not using Debug configuration).
3636
FROM base AS aotdebug
3737
USER root
38-
# Installieren Sie GDB, um natives Debuggen zu unterstützen.
38+
# Install GDB to support native debugging.
3939
RUN apt-get update \
4040
&& apt-get install -y --no-install-recommends \
4141
gdb
4242
USER app
4343

44-
# Diese Stufe wird in der Produktion oder bei Ausführung von VS im regulären Modus verwendet (Standard, wenn die Debugkonfiguration nicht verwendet wird).
45-
FROM ${FINAL_BASE_IMAGE:-mcr.microsoft.com/dotnet/runtime-deps:9.0} AS final
44+
# This stage is used in production or when running from VS in regular mode (Default when not using Debug configuration).
45+
FROM ${FINAL_BASE_IMAGE:-mcr.microsoft.com/dotnet/runtime-deps:10.0} AS final
4646
WORKDIR /app
4747
COPY --from=publish /app/publish .
4848
ENTRYPOINT ["./Kepware.SyncService"]

KepwareSync.Service/Kepware.SyncService.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<UserSecretsId>Kepware-SyncService-26c7b057-7b28-4930-aade-96e5e6829984</UserSecretsId>
88
<Nullable>enable</Nullable>
@@ -31,7 +31,7 @@
3131
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.3" />
3232
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="10.0.3" />
3333
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
34-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
34+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
3535
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.3" />
3636
<PackageReference Include="Polly" Version="8.5.1" />
3737
<PackageReference Include="Serilog" Version="4.2.0" />

0 commit comments

Comments
 (0)