mirror of
https://github.com/wireadmin/wireadmin
synced 2025-03-09 21:30:14 +00:00
build images with docker buildx
driver
This commit is contained in:
parent
84284360a2
commit
4a46d2b34f
38
.github/workflows/docker-image.yaml
vendored
38
.github/workflows/docker-image.yaml
vendored
@ -4,8 +4,6 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
ghcr-build:
|
||||
@ -19,6 +17,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
@ -27,26 +26,14 @@ jobs:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.PRIVATE_TOKEN }}
|
||||
|
||||
# If it was a release tag, use the tag as the image tag,
|
||||
# and otherwise image tag is the commit SHA
|
||||
- name: Set image tag
|
||||
run: |
|
||||
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
||||
echo "Labeling image with TAG: ${GITHUB_REF#refs/tags/v}"
|
||||
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
||||
echo "RELEASE_TAG=,ghcr.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Labeling image with commit SHA: ${GITHUB_SHA}"
|
||||
echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Push to GitHub Container Registry
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}${{ env.RELEASE_TAG }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ghcr.io/${{ env.IMAGE_NAME }}:canary-${{ github.sha }}
|
||||
|
||||
|
||||
docker-build:
|
||||
@ -60,6 +47,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
@ -68,21 +56,11 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set image tag
|
||||
run: |
|
||||
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
||||
echo "Labeling image with TAG: ${GITHUB_REF#refs/tags/v}"
|
||||
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
||||
echo "RELEASE_TAG=,docker.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Labeling image with commit SHA: ${GITHUB_SHA}"
|
||||
echo "IMAGE_TAG=canary-${GITHUB_SHA}" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Push to DockerHub
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}${{ env.RELEASE_TAG }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: docker.io/${{ env.IMAGE_NAME }}:canary-${{ github.sha }}
|
66
.github/workflows/release-image.yaml
vendored
Normal file
66
.github/workflows/release-image.yaml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
name: Build Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
ghcr-build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
env:
|
||||
IMAGE_NAME: shahradelahi/wireadmin
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.PRIVATE_TOKEN }}
|
||||
|
||||
- name: Push to GitHub Container Registry
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ghcr.io/${{ env.IMAGE_NAME }}:latest,ghcr.io/${{ env.IMAGE_NAME }}:${GITHUB_REF#refs/tags/v}
|
||||
|
||||
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
env:
|
||||
IMAGE_NAME: litehex/wireadmin
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Push to DockerHub
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: docker.io/${{ env.IMAGE_NAME }}:latest,docker.io/${{ env.IMAGE_NAME }}:${GITHUB_REF#refs/tags/v}
|
Loading…
Reference in New Issue
Block a user