-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (35 loc) · 1.38 KB
/
docker-build-stage.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
name: Build and push Docker image for staging/development environment
permissions:
contents: read
on:
push:
branches:
- staging
jobs:
docker-build-push-dev:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Short SHA
run: echo "SHORT_SHA=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_ENV
- name: echo Short SHA
run: echo $SHORT_SHA
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.EO_PROJ_STAGING_DOCKER_REGISTRY_URL}}
username: ${{ secrets.EO_PROJ_STAGING_DOCKER_USERNAME }}
password: ${{ secrets.EO_PROJ_STAGING_DOCKER_PASSWORD }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image under tag ${{ env.SHORT_SHA }}
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
cache-from: type=registry,ref=${{ secrets.EO_PROJ_STAGING_DOCKER_REGISTRY_URL }}/stac-accessibility-scanner:cache
cache-to: type=registry,ref=${{ secrets.EO_PROJ_STAGING_DOCKER_REGISTRY_URL }}/stac-accessibility-scanner:cache,mode=max
push: true
tags: ${{ secrets.EO_PROJ_STAGING_DOCKER_REGISTRY_URL }}/stac-accessibility-scanner:${{ env.SHORT_SHA }}