Skip to content

Commit fab76e0

Browse files
committed
Add workflow
1 parent 700233d commit fab76e0

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Tag Name'
10+
required: true
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v1
20+
21+
- name: Login to Docker Hub
22+
uses: docker/login-action@v1
23+
with:
24+
username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
26+
27+
- name: Set tag name
28+
id: tag_name
29+
run: |
30+
if [ "${{ github.event_name }}" = "release" ]; then
31+
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
32+
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
33+
echo "::set-output name=tag::${{ github.event.inputs.tag }}"
34+
fi
35+
36+
- name: Build and push Docker image with Release tag
37+
uses: docker/build-push-action@v2
38+
with:
39+
context: .
40+
file: ./Dockerfile
41+
push: true
42+
tags: |
43+
vinlic/emohaa-free-api:${{ steps.tag_name.outputs.tag }}
44+
vinlic/emohaa-free-api:latest
45+
platforms: linux/amd64,linux/arm64
46+
build-args: TARGETPLATFORM=${{ matrix.platform }}

0 commit comments

Comments
 (0)