FCRM-5432 Surface Water Layers now showing #48
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
name: DOCKER | |
on: | |
push: | |
branches: | |
- release-3.0 | |
workflow_dispatch: | |
env: | |
REPOSITORY: flood_map_planning/app-internal | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones block `git describe --always --tags` from working later in 'Set all tags' | |
# Configure our AWS credentials and region environment variables for use in other GitHub Actions | |
# https://github.com/aws-actions/configure-aws-credentials | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ secrets.AWS_ENV_REGION }} | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ENV_ACCOUNT }}:role/${{ secrets.AWS_ENV_ROLE }} | |
# Login to AWS ECR private. It will use the credentials we configured in the previous step | |
# https://github.com/aws-actions/amazon-ecr-login | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Generate raw tag | |
id: raw-tag | |
run: | |
echo "raw_tag=$(git describe --always --tags)" >> $GITHUB_OUTPUT | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=false | |
images: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPOSITORY }} | |
tags: | | |
type=semver,priority=900,pattern={{raw}} | |
type=raw,priority=800,value=${{ steps.raw-tag.outputs.raw_tag }} | |
labels: | | |
org.opencontainers.image.licenses=OGL-UK-3.0 | |
# Build and push Docker image with Buildx | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
target: production | |
build-args: | | |
GIT_COMMIT=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} | |
BUILD_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.meta.outputs.tags }} | |
# Generate a summary that will be displayed against the Job when selected in the Actions tab. | |
# We this to quickly see details for the image generated instead of digging into the build output. | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary | |
- name: Generate job summary | |
id: summary | |
run: | | |
{ | |
echo "### Docker Image details" | |
echo "The tag is **${{ steps.raw-tag.outputs.raw_tag }}**" | |
echo "| Label | Value |" | |
echo "| ---------- | ----- |" | |
echo "| created | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} |" | |
echo "| description| ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }} |" | |
echo "| licenses | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.licenses'] }} |" | |
echo "| revision | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} |" | |
echo "| source | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.source'] }} |" | |
echo "| title | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.title'] }} |" | |
echo "| url | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.url'] }} |" | |
echo "| version | ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |" | |
} >> $GITHUB_STEP_SUMMARY |