Update docker workflow to try building on validate
This commit is contained in:
parent
ac8c090c4c
commit
074fe79ded
51
.github/workflows/docker.yml
vendored
51
.github/workflows/docker.yml
vendored
@ -10,22 +10,39 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
description: 'Version number'
|
description: 'Version number'
|
||||||
required: true
|
required: true
|
||||||
|
release:
|
||||||
|
type: boolean
|
||||||
|
description: 'Is this a release build?'
|
||||||
|
required: true
|
||||||
secrets:
|
secrets:
|
||||||
docker_username:
|
docker_username:
|
||||||
required: true
|
required: true
|
||||||
docker_token:
|
docker_token:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_IMAGE: ${{ secrets.docker_username }}/libation
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
configure:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
build_and_push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: configure
|
||||||
|
strategy:
|
||||||
|
# Prevent a failure in one image from stopping the other builds
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
@ -38,9 +55,25 @@ jobs:
|
|||||||
username: ${{ secrets.docker_username }}
|
username: ${{ secrets.docker_username }}
|
||||||
password: ${{ secrets.docker_token }}
|
password: ${{ secrets.docker_token }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Generate docker image tags
|
||||||
uses: docker/build-push-action@v5
|
id: metadata
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
push: true
|
flavor: |
|
||||||
build-args: 'FOLDER_NAME=Linux-chardonnay'
|
latest=true
|
||||||
tags: ${{ env.DOCKER_IMAGE }}:latest,${{ env.DOCKER_IMAGE }}:${{ inputs.version }}
|
images: |
|
||||||
|
name=${{ secrets.docker_username }}/libation
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ inputs.version }},enable=${{ inputs.release }}
|
||||||
|
|
||||||
|
- name: Build and push image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: ${{ matrix.arch }}
|
||||||
|
push: ${{ steps.metadata.outputs.tags != ''}}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
TARGET_ARCH=${{ matrix.arch }}
|
||||||
|
|||||||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -23,6 +23,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/docker.yml
|
uses: ./.github/workflows/docker.yml
|
||||||
with:
|
with:
|
||||||
version: ${{ needs.prerelease.outputs.version }}
|
version: ${{ needs.prerelease.outputs.version }}
|
||||||
|
release: true
|
||||||
secrets:
|
secrets:
|
||||||
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
|
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|||||||
8
.github/workflows/validate.yml
vendored
8
.github/workflows/validate.yml
vendored
@ -12,3 +12,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
|
docker:
|
||||||
|
uses: ./.github/workflows/docker.yml
|
||||||
|
with:
|
||||||
|
version: ${GITHUB_SHA}
|
||||||
|
release: false
|
||||||
|
secrets:
|
||||||
|
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
# Dockerfile
|
# Dockerfile
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
||||||
|
ARG TARGET_ARCH=linux-x64
|
||||||
|
|
||||||
COPY Source /Source
|
COPY Source /Source
|
||||||
RUN dotnet publish -c Release -o /Source/bin/Publish/Linux-chardonnay /Source/LibationCli/LibationCli.csproj -p:PublishProfile=/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml
|
RUN dotnet publish \
|
||||||
|
/Source/LibationCli/LibationCli.csproj \
|
||||||
|
--runtime linux-${TARGET_ARCH} \
|
||||||
|
--configuration Release \
|
||||||
|
--output /Source/bin/Publish/Linux-chardonnay \
|
||||||
|
-p:PublishProfile=/Source/LibationCli/Properties/PublishProfiles/LinuxProfile.pubxml
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/runtime:8.0
|
FROM mcr.microsoft.com/dotnet/runtime:8.0
|
||||||
ARG USER_UID=1001
|
ARG USER_UID=1001
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user