mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-21 19:41:36 +01:00
Migrate docker module
This commit is contained in:
committed by
René Pfeuffer
parent
0d92f56937
commit
ca42961131
95
scm-packaging/docker/build.gradle
Normal file
95
scm-packaging/docker/build.gradle
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'com.bmuschko.docker-remote-api' version '6.6.1'
|
||||
}
|
||||
|
||||
import org.gradle.util.VersionNumber
|
||||
import com.bmuschko.gradle.docker.tasks.image.*
|
||||
|
||||
|
||||
configurations {
|
||||
server
|
||||
webapp
|
||||
}
|
||||
|
||||
dependencies {
|
||||
server project(':scm-server')
|
||||
webapp project(path: ':scm-webapp', configuration: 'webapp')
|
||||
}
|
||||
|
||||
task context(type: Copy) {
|
||||
VersionNumber version = VersionNumber.parse(project.version)
|
||||
destinationDir = project.buildDir
|
||||
into('docker') {
|
||||
into('etc') {
|
||||
from('src/main/fs/etc')
|
||||
expand([version: version])
|
||||
}
|
||||
into('opt') {
|
||||
from('src/main/fs/opt')
|
||||
}
|
||||
into('opt/scm-server/lib') {
|
||||
from project.configurations.server
|
||||
}
|
||||
into('opt/scm-server/var/webapp') {
|
||||
from project.configurations.webapp
|
||||
rename {
|
||||
'scm-webapp.war'
|
||||
}
|
||||
}
|
||||
from('.') {
|
||||
include 'Dockerfile'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task distribution(type: DockerBuildImage) {
|
||||
inputDir = file('build/docker')
|
||||
images = images()
|
||||
dependsOn 'context'
|
||||
}
|
||||
|
||||
def images() {
|
||||
def version = project.version
|
||||
if (version.contains('-SNAPSHOT')) {
|
||||
String snapshotVersion = revision
|
||||
def buildNumber = System.getenv("BUILD_NUMBER")
|
||||
if (buildNumber != null) {
|
||||
snapshotVersion += "-${buildNumber}"
|
||||
}
|
||||
version = version.replace("SNAPSHOT", snapshotVersion)
|
||||
return [
|
||||
"docker.io/cloudogu/scm-manager:${version}"
|
||||
]
|
||||
} else {
|
||||
// What about patch releases?
|
||||
// It is a good idea to push always latest
|
||||
return [
|
||||
"docker.io/scmmanager/scm-manager:${version}",
|
||||
'docker.io/scmmanager/scm-manager:latest'
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -42,5 +42,6 @@ include 'scm-packaging:unix'
|
||||
include 'scm-packaging:windows'
|
||||
include 'scm-packaging:deb'
|
||||
include 'scm-packaging:rpm'
|
||||
include 'scm-packaging:docker'
|
||||
|
||||
includeBuild '../gradle-smp-plugin'
|
||||
|
||||
Reference in New Issue
Block a user