Merge branch 'devel'
This commit is contained in:
commit
a21a6f6ea6
11
Dockerfile
11
Dockerfile
@ -1,12 +1,11 @@
|
||||
FROM debian:latest
|
||||
#RUN apt-key update
|
||||
RUN apt-get update
|
||||
RUN apt-get -y upgrade
|
||||
RUN apt-get -y install openjdk-8-jre openjdk-8-jdk
|
||||
RUN apt-get -y install openjdk-8-jre openjdk-8-jdk curl wget
|
||||
WORKDIR /bot_src
|
||||
ADD . /bot_src/
|
||||
RUN chmod +x gradlew
|
||||
ADD DownloadLast.sh /bot_src/
|
||||
RUN chmod +x DownloadLast.sh
|
||||
RUN ./DownloadLast.sh
|
||||
ENV PORT=8080
|
||||
ENV TOKEN=10
|
||||
RUN ./gradlew build
|
||||
CMD java -jar build/libs/DiscordBot-0.1.0.jar -t ${TOKEN}
|
||||
CMD java -jar bot.jar -t ${TOKEN}
|
||||
|
11
DownloadLast.sh
Executable file
11
DownloadLast.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
#This script download the last stable build on jenkins
|
||||
|
||||
data=$(curl -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts")
|
||||
relativePath=$(grep -oPm1 "(?<=<relativePath>)[^<]+" <<< "$data")
|
||||
jarFile=$(grep -oPm1 "(?<=<fileName>)[^<]+" <<< "$data")
|
||||
url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/artifact/"${relativePath}
|
||||
echo ${url}
|
||||
wget ${url} -O bot.jar
|
||||
|
||||
|
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -2,7 +2,10 @@ node {
|
||||
def app
|
||||
stage('Clone') { // for display purposes
|
||||
// Get some code from a GitHub repository
|
||||
git 'https://github.com/BrokenFire/BrokenDiscordBot.git'
|
||||
git url: 'https://github.com/BrokenFire/BrokenDiscordBot.git', branch: 'devel'
|
||||
}
|
||||
stage('Gradle Buil'){
|
||||
build job: 'Bot Discord Gradle', wait: true
|
||||
}
|
||||
stage('Build image') {
|
||||
/* This builds the actual image; synonymous to
|
||||
@ -15,11 +18,10 @@ node {
|
||||
* First, the incremental build number from Jenkins
|
||||
* Second, the 'latest' tag.
|
||||
* Pushing multiple tags is cheap, as all the layers are reused. */
|
||||
app.push()
|
||||
app.push("devel")
|
||||
|
||||
}
|
||||
stage('Cleaning'){
|
||||
sh "docker image prune -f"
|
||||
build job: 'Bot Discord javadoc', wait: false
|
||||
}
|
||||
}
|
||||
|
34
build.gradle
34
build.gradle
@ -8,14 +8,32 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'base'
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
|
||||
def versionObj = new Version(major: 0, minor: 2, revision: 0)
|
||||
|
||||
group = "net.broken"
|
||||
archivesBaseName = "BrokenDiscordBot"
|
||||
version = "$versionObj"
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
|
||||
|
||||
jar.doFirst {
|
||||
delete "${buildDir}/libs/*"
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
baseName = 'DiscordBot'
|
||||
version = '0.1.0'
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -28,8 +46,6 @@ javadoc {
|
||||
classpath = configurations.compile
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
dependencies {
|
||||
compile("org.springframework.boot:spring-boot-starter-web"){
|
||||
@ -56,3 +72,15 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
class Version {
|
||||
String major, minor, revision
|
||||
|
||||
static String getBuild() {
|
||||
System.getenv("BUILD_NUMBER") ?: System.getProperty("BUILD_NUMBER") ?:
|
||||
System.getenv("GIT_COMMIT")?.substring(0, 7) ?: System.getProperty("GIT_COMMIT")?.substring(0, 7) ?:"DEV"
|
||||
}
|
||||
|
||||
String toString() {
|
||||
"${major}.${minor}.${revision}_$build"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user