Groovy web console

subscribe to the feed Subscribe
to this
site

1

Published 4 months ago by 2
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
Map registry = [
    prefix: params.registry_prefix,
    host: params.DOCKER_REGISTRY,
]

Map app = [
    domain: params.domain,
    db_image: 'postgres',
    db_version: '11.6-alpine',
    redis_image: 'keydb',
    redis_version: '6.2.0'
]

def testEnv = [
    POSTGRES_USER: 'user',
    POSTGRES_PASSWORD: 'password'
]

docker.withRegistry("https://${registry.host}/", registry.credid) {
    docker.image("${registry.host}/${registry.prefix}/${app.db_image}:${app.db_version}").withRun("--env-file ${WORKSPACE}/${env_file}") { db ->
        docker.image("${registry.host}/${registry.prefix}/${app.redis_image}:${app.redis_version}").withRun() { redis ->
            container.inside("-u root --link ${db.id}:db --link ${redis.id}:redis --env-file ${WORKSPACE}/${env_file} -v ${WORKSPACE}/tests-report:/code/tests-report") {
                sh "sleep 5"
                sh "pytest -v --migrations"
            }
        }
    }
}