-
Notifications
You must be signed in to change notification settings - Fork 2
32 lines (30 loc) · 1.07 KB
/
build_and_push.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
name: Docker Image CI
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
# pull_request:
# branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build specify tag
run: |
echo 'build image: bronbro/spacebox-crawler:${{github.ref_name}}'
docker build -t bronbro/spacebox-crawler:${{github.ref_name}} --target=app --build-arg version=${{github.ref_name}} .
- name: Build latest tag
if: startsWith(github.ref, 'refs/tags/v')
run: docker build -t bronbro/spacebox-crawler:latest --target=app --build-arg version=latest .
- name: push specify tag to registry
run: docker push bronbro/spacebox-crawler:${{github.ref_name}}
- name: push latest tag to registry
if: startsWith(github.ref, 'refs/tags/v')
run: docker push bronbro/spacebox-crawler:latest