Skip to content

cicd: added docker build action #1

cicd: added docker build action

cicd: added docker build action #1

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
runs-on: ivica-thinkpad-runner-2
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-accesability-scanner:cache
cache-to: type=registry,ref=${{ secrets.EO_PROJ_STAGING_DOCKER_REGISTRY_URL }}/stac-accesability-scanner:cache,mode=max
push: true
tags: ${{ secrets.EO_PROJ_STAGING_DOCKER_REGISTRY_URL }}/stac-accesability-scanner:${{ env.SHORT_SHA }}