Update main.yaml #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: | |
- 'master' | |
jobs: | |
docker-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/eodcgmbh/sen2like | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build base image | |
run: | | |
cd ./sen2like/ | |
docker build -t sen2like_base:latest -f Dockerfile-base . | |
docker build -t sen2like --build-arg SEN2LIKE_BUILD_IMAGE_TAG=sen2like_base:latest . && docker image prune --filter label=stage=sen2like_build -f | |
cd .. | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./sen2like | |
file: ./sen2like/Dockerfile | |
build-args: SEN2LIKE_BUILD_IMAGE_TAG=sen2like_base:latest | |
push: ${{ github.event_name != 'pull_request' && matrix.os == 'ubuntu-20.04'}} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |