initial commit
Gitea/docker-base-images/jdk14-alpine/pipeline/head Something is wrong with the build of this commit
Details
Gitea/docker-base-images/jdk14-alpine/pipeline/head Something is wrong with the build of this commit
Details
commit
3d4671a11f
|
@ -0,0 +1,12 @@
|
||||||
|
ARG BASE_IMAGE="adoptopenjdk/openjdk14:alpine-slim"
|
||||||
|
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
|
# Install docker-cli, docker-compose, git, bash
|
||||||
|
RUN apk update && \
|
||||||
|
apk add --no-cache docker-cli python3 py3-pip git bash && \
|
||||||
|
apk add --no-cache --virtual .docker-compose-deps python3-dev libffi-dev openssl-dev gcc libc-dev make && \
|
||||||
|
pip3 install docker-compose && \
|
||||||
|
apk del .docker-compose-deps
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
def imageName = "jdk14-alpine"
|
||||||
|
def releaseTagPrefix = "release-"
|
||||||
|
def registryHost = "git.tswf.io"
|
||||||
|
|
||||||
|
def resolveImageTag(env) {
|
||||||
|
return env.TAG_NAME?.replace(releaseTagPrefix, '') ?: 'latest'
|
||||||
|
}
|
||||||
|
|
||||||
|
def resolveImageName(env) {
|
||||||
|
return "${registryHost}/docker-base-images/${imageName}:${resolveImageTag(env)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'alpine/git:2.36.3'
|
||||||
|
// Mount docker socket for docker-in-docker
|
||||||
|
args '-v /var/run/docker.sock:/var/run/docker.sock'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('prepare') {
|
||||||
|
steps {
|
||||||
|
// Try to get tag name from git repo if it empty. By default this env fills only at tag builds in Jenkins
|
||||||
|
script {
|
||||||
|
if (env.TAG_NAME == null) {
|
||||||
|
env.TAG_NAME = sh(returnStdout: true, script: "git tag --points-at HEAD").trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('build_docker') {
|
||||||
|
steps {
|
||||||
|
sh "docker build . --tag ${resolveImageName(env)}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('push_docker') {
|
||||||
|
when {
|
||||||
|
tag "${releaseTagPrefix}*"
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh "docker login ${registryHost} -u ${env.GITEA_USER} -p ${env.GITEA_OAUTH_TOKEN}"
|
||||||
|
sh "docker image push ${resolveImageName(env)}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue