mirror of
https://github.com/dagucloud/dagu.git
synced 2026-12-05 05:32:51 +00:00
151 lines
5.2 KiB
YAML
151 lines
5.2 KiB
YAML
name: DockerImage
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
- "v[0-9]+.[0-9]+.[0-9]+-*"
|
|
|
|
jobs:
|
|
# Build and push ubuntu-based latest image
|
|
docker-latest:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
# Remove 'v' prefix from tag
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
# Detect prerelease (version contains '-')
|
|
if [[ "$VERSION" == *-* ]]; then
|
|
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
|
|
else
|
|
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
with:
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DAGU_GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
push: true
|
|
build-args: |
|
|
LDFLAGS=-X 'main.version=${{ env.VERSION }}'
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
|
|
${{ env.IS_PRERELEASE == 'false' && format('ghcr.io/{0}:latest', github.repository) || '' }}
|
|
# Build and push alpine-based dev image
|
|
docker-dev:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
# Remove 'v' prefix from tag
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
# Detect prerelease (version contains '-')
|
|
if [[ "$VERSION" == *-* ]]; then
|
|
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
|
|
else
|
|
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
with:
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DAGU_GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile.dev
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
push: true
|
|
build-args: |
|
|
LDFLAGS=-X 'main.version=${{ env.VERSION }}'
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ env.VERSION }}-dev
|
|
${{ env.IS_PRERELEASE == 'false' && format('ghcr.io/{0}:dev', github.repository) || '' }}
|
|
# Build and push ubuntu-based dev image
|
|
docker-alpine:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Extract version from tag
|
|
id: get_version
|
|
run: |
|
|
# Remove 'v' prefix from tag
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
# Detect prerelease (version contains '-')
|
|
if [[ "$VERSION" == *-* ]]; then
|
|
echo "IS_PRERELEASE=true" >> $GITHUB_ENV
|
|
else
|
|
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
with:
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DAGU_GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile.alpine
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
push: true
|
|
build-args: |
|
|
LDFLAGS=-X 'main.version=${{ env.VERSION }}'
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ env.VERSION }}-alpine
|
|
${{ env.IS_PRERELEASE == 'false' && format('ghcr.io/{0}:alpine', github.repository) || '' }}
|