Skip to content

Merge pull request #47 from SpatialDays/staging #19

Merge pull request #47 from SpatialDays/staging

Merge pull request #47 from SpatialDays/staging #19

name: Build and push Docker image for production environment
permissions:
contents: read
on:
push:
branches:
- prod
jobs:
docker-build-push-dev:
runs-on: ubuntu-latest
steps:
# Checkout the main repository
- name: Checkout main repo
uses: actions/checkout@v3
# Checkout the inner repository (nested git repo)
- name: Checkout stac-proprietary-parsers repo
uses: actions/checkout@v3
with:
repository: SpatialDays/stac-proprietary-parsers
token: ${{ secrets.GH_PAT }}
path: app/stac/services/metadata_parsers/proprietary
# Set Short SHA
- name: Set Short SHA
run: echo "SHORT_SHA=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_ENV
# Log in to the Container registry
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.EO_PROJ_PROD_DOCKER_REGISTRY_URL }}
username: ${{ secrets.EO_PROJ_PROD_DOCKER_USERNAME }}
password: ${{ secrets.EO_PROJ_PROD_DOCKER_PASSWORD }}
# Set up Docker Buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# Build and push Docker image under tag ${{ env.SHORT_SHA }}
- 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_PROD_DOCKER_REGISTRY_URL }}/stac-generator:cache
cache-to: type=registry,ref=${{ secrets.EO_PROJ_PROD_DOCKER_REGISTRY_URL }}/stac-generator:cache,mode=max
push: true
tags: ${{ secrets.EO_PROJ_PROD_DOCKER_REGISTRY_URL }}/stac-generator:${{ env.SHORT_SHA }}
- name: Build and push Docker image under tag ${{ env.SHORT_SHA }} - redis
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-redis
cache-from: type=registry,ref=${{ secrets.EO_PROJ_PROD_DOCKER_REGISTRY_URL }}/stac-generator-redis:cache
cache-to: type=registry,ref=${{ secrets.EO_PROJ_PROD_DOCKER_REGISTRY_URL }}/stac-generator-redis:cache,mode=max
push: true
tags: ${{ secrets.EO_PROJ_PROD_DOCKER_REGISTRY_URL }}/stac-generator-redis:${{ env.SHORT_SHA }}