-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (34 loc) · 1.2 KB
/
docker-image.yml
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
name: Docker Image CI
on:
create:
workflow_dispatch:
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_NAMESPACE: ${{ secrets.DOCKER_NAMESPACE }}
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
jobs:
push_to_registry:
if: ${{ startsWith(github.ref, 'refs/tags') }}
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: client_meta
uses: docker/[email protected]
with:
images: ${{ env.DOCKER_NAMESPACE }}/${{ env.DOCKER_REPOSITORY }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.client_meta.outputs.tags }}