-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (38 loc) · 1.18 KB
/
build-push-tag.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# This workflow will build a Docker Image with a given tag and push it to DockerHub
name: Build and push tag to DockerHub
on:
workflow_dispatch:
inputs:
docker_tag:
description: 'Tag name'
required: true
default: 'gpu'
dockerfile_name:
description: 'Dockerfile name'
required: true
default: 'Dockerfile.gpu'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
ref: main
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build tag and push
env:
DOCKER_TAG: ${{ github.event.inputs.docker_tag }}
DOCKERFILE_PATH: ${{ github.event.inputs.dockerfile_name }}
DOCKER_REPO: gmontamat/python-darknet
IMAGE_NAME: gmontamat/python-darknet:${{ github.event.inputs.docker_tag }}
run: |
chmod +x ./hooks/build
./hooks/build
docker push $IMAGE_NAME
chmod +x ./hooks/post_push
./hooks/post_push