-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (33 loc) · 1.06 KB
/
build_base_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: Build base image for CI
on:
pull_request:
branches:
- main
paths:
- 'Dockerfile'
- 'Makefile'
workflow_dispatch:
# GitHub secrets
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
IMAGE_NAME: dbt-bigquery-monitoring-base
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build-base-image:
name: Build base image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR
- name: Log in to Docker Hub
run: |
echo ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.DOCKER_REGISTRY_USER }} --password-stdin
- name: Build base image
run: |
docker build -t $IMAGE_NAME:$BRANCH_NAME .
- name: Push base image
run: |
docker tag $IMAGE_NAME:$BRANCH_NAME $DOCKER_REGISTRY/$IMAGE_NAME:$BRANCH_NAME
docker push $DOCKER_REGISTRY/$IMAGE_NAME:$BRANCH_NAME