mirror of
https://github.com/yanhao98/docker-example.git
synced 2025-07-13 20:30:48 +08:00
Compare commits
4 Commits
v1.0.1-bet
...
v1.0.1-bet
Author | SHA1 | Date | |
---|---|---|---|
39b732b10f | |||
9b1be9863c | |||
366f1206ed | |||
bb62a67cb2 |
69
.gitea/workflows/release-tag.yaml
Normal file
69
.gitea/workflows/release-tag.yaml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
name: Release Tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE_NAME: murielmay67761/docker-example
|
||||||
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
DOCKER_LATEST: latest
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.io
|
||||||
|
username: ${{ env.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ env.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
/tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
docker.io/${{ env.DOCKER_IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.DOCKER_LATEST }}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||||
|
|
||||||
|
- name: Print metadata
|
||||||
|
run: |
|
||||||
|
echo "tags: ${{ steps.meta.outputs.tags }}"
|
||||||
|
echo "labels: ${{ steps.meta.outputs.labels }}"
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
@ -1,16 +1,17 @@
|
|||||||
name: Build Docker Image
|
# https://gitea.com/gitea/act_runner/src/commit/0e2a3e00f5b32d5407f4f929a1ae61d3df825362/.gitea/workflows/release-nightly.yml
|
||||||
|
name: Release Nightly
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_IMAGE_NAME: yanhao98/docker-example
|
|
||||||
GHCR_IMAGE_NAME: ${{ github.repository }}
|
GHCR_IMAGE_NAME: ${{ github.repository }}
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GHCR_USERNAME: ${{ github.repository_owner }}
|
GHCR_USERNAME: ${{ github.repository_owner }}
|
||||||
|
DOCKER_LATEST: nightly
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@ -19,13 +20,6 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# - name: Login to DockerHub
|
|
||||||
# uses: docker/login-action@v3
|
|
||||||
# with:
|
|
||||||
# registry: docker.io
|
|
||||||
# username: ${{ env.DOCKER_USERNAME }}
|
|
||||||
# password: ${{ env.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@ -39,36 +33,17 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# - name: Cache Docker layers
|
|
||||||
# uses: actions/cache@v4
|
|
||||||
# with:
|
|
||||||
# path: |
|
|
||||||
# /tmp/.buildx-cache
|
|
||||||
# key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
||||||
# restore-keys: |
|
|
||||||
# ${{ runner.os }}-buildx-
|
|
||||||
|
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
# docker.io/${{ env.DOCKER_IMAGE_NAME }}
|
|
||||||
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
type=raw,value=${{ env.DOCKER_LATEST }}
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||||
|
|
||||||
# type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
|
|
||||||
# type=schedule,pattern={{date 'YYYYMMDD-HHmmss' tz='UTC'}}
|
|
||||||
# type=ref,event=branch
|
|
||||||
# type=ref,event=pr
|
|
||||||
# type=semver,pattern={{version}}
|
|
||||||
# type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
|
||||||
# type=sha
|
|
||||||
|
|
||||||
- name: Print metadata
|
- name: Print metadata
|
||||||
run: |
|
run: |
|
||||||
echo "tags: ${{ steps.meta.outputs.tags }}"
|
echo "tags: ${{ steps.meta.outputs.tags }}"
|
||||||
@ -84,6 +59,4 @@ jobs:
|
|||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
# cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
# cache-to: type=local,dest=/tmp/.buildx-cache
|
|
14
README.md
14
README.md
@ -1 +1,13 @@
|
|||||||
# docker-example
|
# docker-example
|
||||||
|
|
||||||
|
```
|
||||||
|
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||||
|
# type=pep440,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
|
# type=schedule,pattern={{date 'YYYYMMDD-HHmmss' tz='UTC'}}
|
||||||
|
# type=ref,event=branch
|
||||||
|
# type=ref,event=pr
|
||||||
|
# type=semver,pattern={{version}}
|
||||||
|
# type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||||
|
# type=sha
|
||||||
|
```
|
Reference in New Issue
Block a user