2023-02-07 14:38:17 +08:00
|
|
|
name: Build DockerHub Image
|
2022-10-18 17:52:24 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-02-08 16:22:55 +08:00
|
|
|
branches: [ "main"]
|
2022-10-18 17:52:24 +08:00
|
|
|
tags:
|
2022-11-14 11:08:28 +08:00
|
|
|
- v2.*
|
|
|
|
- v1.*
|
|
|
|
- v0.*
|
2022-10-27 10:22:43 +08:00
|
|
|
# pull_request:
|
|
|
|
# branches: [ "main" ]
|
2022-10-18 17:52:24 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-02-01 18:29:31 +08:00
|
|
|
runs-on: [self-hosted, linux]
|
2022-10-18 17:52:24 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2023-02-07 14:35:23 +08:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
2023-02-07 15:08:52 +08:00
|
|
|
images: answerdev/answer
|
2023-02-07 14:35:23 +08:00
|
|
|
tags: |
|
|
|
|
type=raw,value=latest
|
|
|
|
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
|
2022-11-11 18:16:58 +08:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-10-18 17:52:24 +08:00
|
|
|
|
|
|
|
- name: Login to DockerHub
|
2023-02-07 14:35:23 +08:00
|
|
|
uses: docker/login-action@v2
|
2022-10-18 17:52:24 +08:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
2023-02-07 14:35:23 +08:00
|
|
|
- name: Build and push
|
2023-02-06 14:11:35 +08:00
|
|
|
uses: docker/build-push-action@v4
|
2022-10-18 17:52:24 +08:00
|
|
|
with:
|
|
|
|
context: .
|
2023-02-07 14:35:23 +08:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-10-18 17:52:24 +08:00
|
|
|
push: true
|
2023-06-12 17:58:24 +08:00
|
|
|
file: ./Dockerfile
|
2022-10-18 17:52:24 +08:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|
|
|