Merge branch 'devel'
This commit is contained in:
commit
a21a6f6ea6
11
Dockerfile
11
Dockerfile
@ -1,12 +1,11 @@
|
|||||||
FROM debian:latest
|
FROM debian:latest
|
||||||
#RUN apt-key update
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get -y upgrade
|
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
|
WORKDIR /bot_src
|
||||||
ADD . /bot_src/
|
ADD DownloadLast.sh /bot_src/
|
||||||
RUN chmod +x gradlew
|
RUN chmod +x DownloadLast.sh
|
||||||
|
RUN ./DownloadLast.sh
|
||||||
ENV PORT=8080
|
ENV PORT=8080
|
||||||
ENV TOKEN=10
|
ENV TOKEN=10
|
||||||
RUN ./gradlew build
|
CMD java -jar bot.jar -t ${TOKEN}
|
||||||
CMD java -jar build/libs/DiscordBot-0.1.0.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
|
def app
|
||||||
stage('Clone') { // for display purposes
|
stage('Clone') { // for display purposes
|
||||||
// Get some code from a GitHub repository
|
// 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') {
|
stage('Build image') {
|
||||||
/* This builds the actual image; synonymous to
|
/* This builds the actual image; synonymous to
|
||||||
@ -15,11 +18,10 @@ node {
|
|||||||
* First, the incremental build number from Jenkins
|
* First, the incremental build number from Jenkins
|
||||||
* Second, the 'latest' tag.
|
* Second, the 'latest' tag.
|
||||||
* Pushing multiple tags is cheap, as all the layers are reused. */
|
* Pushing multiple tags is cheap, as all the layers are reused. */
|
||||||
app.push()
|
app.push("devel")
|
||||||
|
|
||||||
}
|
}
|
||||||
stage('Cleaning'){
|
stage('Cleaning'){
|
||||||
sh "docker image prune -f"
|
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: 'java'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
apply plugin: 'org.springframework.boot'
|
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 {
|
jar {
|
||||||
|
|
||||||
baseName = 'DiscordBot'
|
baseName = 'DiscordBot'
|
||||||
version = '0.1.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -28,8 +46,6 @@ javadoc {
|
|||||||
classpath = configurations.compile
|
classpath = configurations.compile
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("org.springframework.boot:spring-boot-starter-web"){
|
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