Build and Push image #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push image | |
on: | |
create | |
jobs: | |
publish_image: | |
name: Build and Push apisix-base image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
with: | |
submodules: recursive | |
- name: Extract Tags name | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
id: tag_env | |
shell: bash | |
run: | | |
echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})" | |
- name: Extract Tags Type | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
id: tag_type | |
shell: bash | |
run: | | |
echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/tags/})" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
if: ${{ startsWith(steps.tag_type.outputs.version, 'apisix-base/') }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push Docker Image | |
if: ${{ startsWith(steps.tag_type.outputs.version, 'apisix-base/') }} | |
run: | | |
docker buildx build -t api7/apisix-base:${{ steps.tag_env.outputs.version }} --push \ | |
--build-arg VERSION=${{ steps.tag_env.outputs.version }} --platform linux/amd64,linux/arm64 \ | |
-f ./dockerfiles/Dockerfile.apisix-base.apk . |