-
Notifications
You must be signed in to change notification settings - Fork 13
47 lines (42 loc) · 1.22 KB
/
build-docker.yaml
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
45
46
47
name: Build Docker image
on:
push:
branches:
- master
paths:
- ".github/workflows/cd.yaml"
- "pipelines/**/*"
- "pyproject.toml"
- "Dockerfile"
pull_request:
branches:
- master
paths:
- ".github/workflows/cd_staging.yaml"
- "pipelines/**/*"
- "pyproject.toml"
- "Dockerfile"
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
GH_PAT: ${{ secrets.GH_PAT }}
IMAGE_NAME: ghcr.io/basedosdados/prefect-flows
jobs:
build-container:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Google Cloud CLI
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
export_default_credentials: true
- name: Build and publish Prefect Agent image
run: |
docker build -t $IMAGE_NAME:$GITHUB_SHA .
docker build -t $IMAGE_NAME:latest .
echo $GH_PAT | docker login ghcr.io -u gabriel-milan --password-stdin
docker push $IMAGE_NAME:$GITHUB_SHA
docker push $IMAGE_NAME:latest