fix CKAN container healthcheck in prod/staging (#96) #115
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: Create Ckan Base image | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- '.github/workflows/cypress.yml' | |
- '.github/workflows/tests.yml' | |
- '.github/workflows/docker-dev-image.yml' | |
- '.github/workflows/docker-nginx-image.yml' | |
- '.github/workflows/docker-postgresql-image.yml' | |
- '.github/workflows/docker-deployment-image.yml' | |
- '.github/workflows/deploy.yml' | |
- '.github/ISSUE_TEMPLATE' | |
- '.github/PULL_REQUEST_TEMPLATE.md' | |
- 'contrib/docker-ckan/postgresql/**' | |
- 'contrib/docker-ckan/nginx/**' | |
- 'contrib/docker-ckan/dev-base/**' | |
- 'contrib/docker-ckan/dev-deploy/**' | |
- 'contrib/docker-ckan/prod/**' | |
- 'contrib/docker-ckan/docker-compose.dev.yml' | |
- 'contrib/docker-ckan/docker-compose.yml' | |
- 'contrib/docker-ckan/dev.env.template' | |
- 'contrib/docker-ckan/prod.env.template' | |
jobs: | |
build-base-image: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.ROLE_OIDC }} | |
aws-region: eu-west-2 | |
role-session-name: CKANDockerDeployment | |
- name: Login into the Container Registry | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
# TODO: use Docker Metadata action in the future to manage the semantic versioning of images | |
- name: Set sha output | |
id: sha | |
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)" | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
file: ./contrib/docker-ckan/base/Dockerfile | |
context: . | |
platforms: linux/amd64 | |
builder: ${{ steps.buildx.outputs.name }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
# don't push the image if it's a pull request, only build it which is a way of testing if the image can be successfully built | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ secrets.CONTAINER_REGISTRY_URL }}/mdepckan/ckan-base:${{ steps.sha.outputs.sha }} | |
${{ secrets.CONTAINER_REGISTRY_URL }}/mdepckan/ckan-base:latest | |
# labels: ${{ steps.docker_meta.outputs.labels }} | |
build-args: | | |
INTERNAL_REG=${{ secrets.CONTAINER_REGISTRY_URL }} | |