Skip to content

Commit d86971e

Browse files
committed
ci: add docker build action
1 parent 666a50f commit d86971e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/docker_build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out code into the Go module directory
14+
uses: actions/checkout@v3
15+
16+
- name: Set build tag as env var
17+
run: echo "TAG=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
18+
19+
- name: Docker login
20+
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
21+
22+
- name: Build the Docker image
23+
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/blackjackbot:latest --tag ${{ secrets.DOCKERHUB_USERNAME }}/blackjackbot:${{ env.TAG }}
24+
25+
- name: Push the Docker image
26+
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/blackjackbot --all-tags

0 commit comments

Comments
 (0)