-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (77 loc) · 3.49 KB
/
publish-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Publish Docker Images
on:
release:
types: [ published ]
permissions:
packages: read
jobs:
docker-linux:
runs-on: ubuntu-latest
strategy:
matrix:
project:
- { name: "DragonFruit.OnionFruit.Web", tag-prefix: "" }
- { name: "DragonFruit.OnionFruit.Web.Worker", tag-prefix: "worker-" }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup GitHub NuGet
run: dotnet nuget update source dragonfruit --username USERNAME --password ${{ github.token }} --store-password-in-clear-text
- name: Build
run: dotnet publish -c Release -p:UseAppHost=false -p:Version=${{ github.event.release.tag_name }} ${{ matrix.project.name }}
- name: Image Build and Push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.project.name }}/bin/Release/net8.0/publish
tags: dragonfruitdotnet/onionfruit-web:${{ matrix.project.tag-prefix }}linux
platforms: linux/arm64,linux/amd64
file: ${{ matrix.project.name }}/Dockerfile
push: true
docker-windows:
runs-on: windows-latest
strategy:
matrix:
project:
- { name: "DragonFruit.OnionFruit.Web", tag-prefix: "" }
- { name: "DragonFruit.OnionFruit.Web.Worker", tag-prefix: "worker-" }
env:
DOCKER_TAG: dragonfruitdotnet/onionfruit-web:${{ matrix.project.tag-prefix }}windows
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup GitHub NuGet
run: dotnet nuget update source github --username USERNAME --password ${{ github.token }} --store-password-in-clear-text
- name: Build
run: dotnet publish -c Release -p:UseAppHost=false -p:Version=${{ github.event.release.tag_name }} ${{ matrix.project.name }}
- name: Image Build
run: docker build -f ${{ matrix.project.name }}\Dockerfile -t ${{ env.DOCKER_TAG }} --build-arg "IMAGEVARIANT=nanoserver-ltsc2022" ${{ matrix.project.name }}\bin\Release\net8.0\publish
- name: Image Push
run: docker push ${{ env.DOCKER_TAG }}
docker-multiarch-image:
runs-on: ubuntu-latest
needs:
- docker-linux
- docker-windows
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create MultiArch+MultiOS Manifest (Server)
run: docker buildx imagetools create -t dragonfruitdotnet/onionfruit-web -t dragonfruitdotnet/onionfruit-web:${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:windows dragonfruitdotnet/onionfruit-web:linux
- name: Create MultiArch+MultiOS Manifest (Worker)
run: docker buildx imagetools create -t dragonfruitdotnet/onionfruit-web:worker -t dragonfruitdotnet/onionfruit-web:worker-${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:worker-windows dragonfruitdotnet/onionfruit-web:worker-linux