Skip to content

Build Image Nightly for Docker #1247

Build Image Nightly for Docker

Build Image Nightly for Docker #1247

Workflow file for this run

---
name: Build Image Nightly for Docker
on:
workflow_dispatch:
inputs:
version:
description: Image Tag
default: nightly
required: true
git-ref:
description: Git Ref
default: master
required: true
schedule:
- cron: "30 23 * * *"
#push:
#branches: [ ci ]
jobs:
docker:
name: Build image and push after successfull calculation
runs-on: ubuntu-latest
steps:
# This Checkout is necessary when using a context in docker/build-push-action
- name: Clone Repository (Latest)
uses: actions/checkout@v4
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v4
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Build image engine with tag nightly during scheduled task
if: github.event.inputs.version == ''
env:
DOCKER_USERNAME: ${{ secrets.docker_username }}
DOCKER_PASSWORD: ${{ secrets.docker_password }}
DOCKER_TAG: ${{ github.event.inputs.version }}
REPO_REF: ${{ github.event.inputs.git-ref }}
id: docker_engine_scheduled
run: |
docker build --build-arg oq_branch=master -t openquake/engine:nightly -f docker/Dockerfile.dev docker
docker image ls
time docker run openquake/engine:nightly "oq engine --run /usr/src/oq-engine/demos/risk/ScenarioDamage/job_hazard.ini /usr/src/oq-engine/demos/risk/ScenarioDamage/job_risk.ini"
echo " push image engine with tag nightly on docker hub "
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push openquake/engine:nightly
- name: Build image engine with tag ${{ github.event.inputs.version }} during manual run
if: github.event.inputs.version != ''
env:
DOCKER_USERNAME: ${{ secrets.docker_username }}
DOCKER_PASSWORD: ${{ secrets.docker_password }}
DOCKER_TAG: ${{ github.event.inputs.version }}
REPO_REF: ${{ github.event.inputs.git-ref }}
id: docker_engine_manual
run: |
docker build --build-arg oq_branch=$REPO_REF -t openquake/engine:$DOCKER_TAG -f docker/Dockerfile.dev docker
docker image ls
#time docker run openquake/engine:$DOCKER_TAG "(oq dbserver start &) ; sleep 10 ; (oq engine --run "https://github.com/gem/oq-engine/blob/master/openquake/server/tests/data/classical.zip?raw=true")"
time docker run openquake/engine:$DOCKER_TAG "(oq engine --run "https://github.com/gem/oq-engine/blob/master/openquake/server/tests/data/classical.zip?raw=true")"
echo " push image engine with tag nightly on ocker hub "
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push openquake/engine:$DOCKER_TAG