Skip to content

Create dev container #52

Create dev container

Create dev container #52

Workflow file for this run

name: Create dev container
on:
# run every Monday at 4:00 AM
schedule:
- cron: "0 4 * * 1"
# schedule manually
workflow_dispatch:
inputs:
# On workflow dispatch, `branch` is selected by default
# You can access it in `github.ref_name`
tag_name:
description: "Tag name for the container"
required: true
default: "latest"
container_repository_branch:
description: "Branch of the container repository"
required: true
default: "main"
jobs:
create-container:
if: github.event_name != 'schedule' || github.repository_owner == 'geo-engine'
runs-on: ubuntu-24.04
permissions:
contents: read
env:
TAG_NAME: latest
CONTAINER_REPOSITORY_BRANCH: main
CONTAINER_NAME: devcontainer
steps:
- name: Modify TAG_NAME if on `tag_name` is set on `workflow_dispatch`
if: github.event.inputs.tag_name != ''
run: |
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- name: Modify CONTAINER_REPOSITORY_BRANCH if on `container_repository_branch` is set on `workflow_dispatch`
if: github.event.inputs.container_repository_branch != ''
run: |
echo "CONTAINER_REPOSITORY_BRANCH=${{ github.event.inputs.container_repository_branch }}" >> $GITHUB_ENV
- name: Checkout container files
uses: actions/checkout@v4
with:
repository: geo-engine/geoengine-container
ref: ${{ env.CONTAINER_REPOSITORY_BRANCH }}
ssh-key: ${{ secrets.CONTAINER_GITHUB_TOKEN }}
path: "container"
- name: Login to quay.io
run: podman login -u="geoengine+bot" -p="${{secrets.QUAY_IO_TOKEN}}" quay.io
- name: Build with podman
run: |
podman build \
--tag ${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} \
.
working-directory: container/${{env.CONTAINER_NAME}}
- name: Push image to quay.io
run: podman push ${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} quay.io/geoengine/${{env.CONTAINER_NAME}}:${{env.TAG_NAME}}
- name: Push latest with date
if: env.TAG_NAME == 'latest'
run: podman push ${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} quay.io/geoengine/${{env.CONTAINER_NAME}}:${{env.TAG_NAME}}-$(date +'%Y-%m-%d')
notify-slack-on-failure:
name: Post to a Slack channel in case of failure
needs: create-container
if: always()
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Post to a Slack channel
if: ${{ needs.create-container.result == 'failure' }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: "geoengine-dev-core"
slack-message: "⚠️ The workflow ${{ github.workflow }} in the repository ${{ github.event.repository.name }} FAILED!"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}