Merge branch 'test/github-actions'
commit
0cfeb76bba
@ -1,74 +0,0 @@
|
||||
def main(ctx):
|
||||
tags = [ctx.build.commit]
|
||||
|
||||
if ctx.build.event == "tag":
|
||||
name = "release"
|
||||
elif ctx.build.branch == "master":
|
||||
name = "master"
|
||||
tags.append("latest")
|
||||
else:
|
||||
return
|
||||
|
||||
return [
|
||||
{
|
||||
"kind": "pipeline",
|
||||
"name": name,
|
||||
"steps": [
|
||||
{
|
||||
"name": "prepare data",
|
||||
"image": "alpine",
|
||||
"commands": [
|
||||
"apk update && apk add bash curl",
|
||||
"FORCE_DOWNLOAD=y ./build-tmp-XXX"
|
||||
]
|
||||
},
|
||||
# We can't glob and have to add here manually...
|
||||
step_for(ctx, "core", tags),
|
||||
step_for(ctx, "core-cuda10.0", tags),
|
||||
step_for(ctx, "core-cuda10.1", tags),
|
||||
|
||||
step_for(ctx, "dinglehopper", tags),
|
||||
step_for(ctx, "ocrd_calamari", tags),
|
||||
step_for(ctx, "ocrd_calamari03", tags),
|
||||
step_for(ctx, "ocrd_cis", tags),
|
||||
step_for(ctx, "ocrd_fileformat", tags),
|
||||
step_for(ctx, "ocrd_olena", tags),
|
||||
step_for(ctx, "ocrd_segment", tags),
|
||||
step_for(ctx, "ocrd_tesserocr", tags),
|
||||
step_for(ctx, "ocrd_wrap", tags),
|
||||
step_for(ctx, "sbb_binarization", tags),
|
||||
step_for(ctx, "sbb_textline_detector", tags),
|
||||
step_for(ctx, "eynollah", tags),
|
||||
step_for(ctx, "ocrd_anybaseocr", tags),
|
||||
{
|
||||
"name": "notify",
|
||||
"image": "drillster/drone-email",
|
||||
"settings": {
|
||||
"host": "172.17.0.1",
|
||||
"port": "25",
|
||||
"from": "drone@ci.moegen-wir.net",
|
||||
},
|
||||
"when": {
|
||||
"status": [ "success", "failure" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def step_for(ctx, sub_image, tags):
|
||||
return {
|
||||
"name": "build %s" % sub_image,
|
||||
"image": "plugins/docker",
|
||||
"settings": {
|
||||
"build_args": [
|
||||
"DRONE_COMMIT=%s" % ctx.build.commit,
|
||||
],
|
||||
"tags": tags,
|
||||
"username": { "from_secret": "docker_username" },
|
||||
"password": { "from_secret": "docker_password" },
|
||||
"repo": "quratorspk/ocrd-galley-%s" % sub_image,
|
||||
"dockerfile": "Dockerfile-%s" % sub_image,
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python3
|
||||
import glob
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
import json
|
||||
|
||||
|
||||
all_subimages = {re.sub(r"^Dockerfile-", "", dockerfile) for dockerfile in glob.glob("Dockerfile-*")}
|
||||
core_subimages = {si for si in all_subimages if si.startswith("core")}
|
||||
rest_subimages = all_subimages - core_subimages
|
||||
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='List subimages.')
|
||||
parser.add_argument('--core', action='store_true',
|
||||
default=False, help='List core subimages')
|
||||
parser.add_argument('--rest', action='store_true',
|
||||
default=False, help='List rest subimages')
|
||||
parser.add_argument('--json', action='store_true',
|
||||
default=False, help='Return list as JSON')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def list_(subimages):
|
||||
subimages = sorted(subimages)
|
||||
if args.json:
|
||||
print(json.dumps(subimages))
|
||||
else:
|
||||
print("\n".join(subimages))
|
||||
|
||||
|
||||
if not args.core and not args.rest:
|
||||
list_(core_subimages | rest_subimages)
|
||||
if args.core:
|
||||
list_(core_subimages)
|
||||
if args.rest:
|
||||
list_(rest_subimages)
|
@ -0,0 +1,58 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
subimage:
|
||||
required: true
|
||||
type: string
|
||||
tags:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
|
||||
|
||||
jobs:
|
||||
build-subimage-job:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
# We are checking out explicitly, so build-push-action isn't trying
|
||||
# to checkout the (unreachable) submodule. (Using "context" there.)
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
quratorspk/ocrd-galley-${{ inputs.subimage }}
|
||||
flavor: |
|
||||
latest=auto
|
||||
# latest=auto should generate "latest" for the type=semver tags entry
|
||||
tags: ${{ inputs.tags }}
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build ${{ inputs.subimage }}
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile-${{ inputs.subimage }}
|
||||
build-args: |
|
||||
GIT_COMMIT=sha-${{ github.sha }}
|
||||
BUILDKIT_INLINE_CACHE=1
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
push: true
|
||||
|
||||
cache-from: quratorspk/ocrd-galley-${{ inputs.subimage }}:sha-${{ github.sha }}
|
@ -1,3 +0,0 @@
|
||||
[submodule "data"]
|
||||
path = data
|
||||
url = git@code.dev.sbb.berlin:qurator/qurator-data.git
|
@ -1 +0,0 @@
|
||||
Subproject commit 9ab08a3626dde1d38dd622b65e425277cd029722
|
Loading…
Reference in New Issue