-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (38 loc) · 1.19 KB
/
docker-image.yml
File metadata and controls
44 lines (38 loc) · 1.19 KB
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
42
43
44
name: Docker Image CI
on:
push:
branches:
- main
- develop
tags:
- 'v*.*.*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker image
run: |
TAG="ghcr.io/${{ github.repository_owner }}/autodns"
if [[ "${{ github.ref_name }}" == "main" ]]; then
IMAGE_TAG="latest"
elif [[ "${{ github.ref_name }}" == "develop" ]]; then
IMAGE_TAG="develop"
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
IMAGE_TAG="${{ github.ref_name }}"
fi
FULL_TAG="${TAG}:${IMAGE_TAG}"
echo "Building and pushing Docker image with tag $FULL_TAG"
docker build . --file DOCKERFILE --tag $FULL_TAG
docker push $FULL_TAG