-
Notifications
You must be signed in to change notification settings - Fork 277
64 lines (62 loc) · 2.83 KB
/
docker_dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
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