-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (35 loc) · 1.18 KB
/
docker-build.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
41
42
43
44
name: Docker Build
on:
push:
branches: [main]
### Ensures that only one CI task per branch/environment will run at a time ###
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
docker-build:
name: Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push docker image
shell: bash
env:
REGISTRY: dungpham91
REPOSITORY: lint-json-inside-yaml
run: |
TAG_VERSION=$(git fetch --tags && git describe --tags $(git rev-list --tags --max-count=1))
docker build \
-t $REGISTRY/$REPOSITORY:${TAG_VERSION} \
-t $REGISTRY/$REPOSITORY:latest \
-f Dockerfile .
echo "Pushing image to repository..."
docker push $REGISTRY/$REPOSITORY --all-tags