62 lines (52 loc) · 2.21 KB
/
docker_build_publish.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
name: Docker image publish
on:
push:
branches: [ main, dev, docker ]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
docker-build-publish:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
# cross publish locally to reduce time taken
- run: dotnet publish "FreshOnion" -c Release -o publish/linux/amd64 --runtime linux-musl-x64 --self-contained true
- run: dotnet publish "FreshOnion" -c Release -o publish/linux/arm/v7 --runtime linux-musl-arm --self-contained true
- run: dotnet publish "FreshOnion" -c Release -o publish/linux/arm64 --runtime linux-musl-arm64 --self-contained true
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build dockerfile
if: success() && github.ref != 'refs/heads/main'
timeout-minutes: 360
run: |
set -x
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
docker buildx build \
--platform=linux/amd64,linux/arm/v7,linux/arm64/v8 \
--output "type=image,push=true" \
--build-arg maintainer=${{ github.repository_owner }} \
--file ./docker/Dockerfile . \
--tag ghcr.io/${{ github.repository_owner }}/freshonion/freshonion-testing:latest
- name: Build dockerfile
if: success() && github.ref == 'refs/heads/main'
timeout-minutes: 360
run: |
set -x
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
docker buildx build \
--platform=linux/amd64,linux/arm/v7,linux/arm64/v8 \
--output "type=image,push=true" \
--build-arg maintainer=${{ github.repository_owner }} \
--file ./docker/Dockerfile . \
--tag ghcr.io/${{ github.repository_owner }}/freshonion/freshonion:latest