Updated docker configuration

This commit is contained in:
Eugene Zadyra
2018-12-05 18:08:46 +01:00
parent ea471cdfd3
commit ff7a098f7a
7 changed files with 40 additions and 33 deletions

View File

@@ -1,5 +1,4 @@
group = 'com.lbs'
version = '0.0.1-SNAPSHOT'
ext {
scalaVersion = "2.12.6"
@@ -7,7 +6,6 @@ ext {
allprojects {
group = 'com.lbs'
version = '1.0.0-SNAPSHOT'
}
apply plugin: 'idea'

View File

@@ -1,8 +1,8 @@
FROM openjdk:8-jdk-alpine
RUN apk update && apk upgrade && apk add netcat-openbsd
RUN mkdir -p /usr/local/luxmedbookingservice
ADD @project.build.finalName@.jar /usr/local/luxmedbookingservice/
RUN mkdir -p /app
ADD server.jar /app
ADD run.sh run.sh
RUN chmod +x run.sh
CMD ./run.sh

View File

@@ -1,18 +1,25 @@
version: '3'
version: '3.4'
services:
luxmedbookingservice:
build: .
environment:
TELEGRAM_TOKEN: ${TELEGRAM_TOKEN}
SECURITY_SECRET: ${SECURITY_SECRET}
DB_HOST: "database"
volumes:
- ./log:/usr/local/luxmedbookingservice/log
- lbs:/lbs
database:
image: postgres:9.5
image: postgres:10.6
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- POSTGRES_USER=lbs
- POSTGRES_PASSWORD=lsb123
- POSTGRES_DB=lbs
- POSTGRES_DB=lbs
volumes:
postgres:
name: postgres
lbs:
name: lbs

View File

@@ -6,7 +6,27 @@ echo "********************************************************"
while ! `nc -z database 5432`; do sleep 3; done
echo "******** Database Server has started "
echo "********************************************************"
echo "Reading env file"
echo "********************************************************"
env="/lbs/config/env"
if [ -f "$env" ]
then
while IFS='=' read -r key value
do
key=$(echo ${key} | tr '.' '_')
export ${key}=${value}
done < "$env"
else
echo "$env not found."
exit 1
fi
echo "********************************************************"
echo "Starting Luxmed Booking Service "
echo "********************************************************"
cd /usr/local/luxmedbookingservice && java -jar @project.build.finalName@.jar
cd /app && java -jar server.jar

View File

@@ -1,8 +1,6 @@
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
ext {
springBootVersion = '2.0.2.RELEASE'
springBootVersion = '2.1.1.RELEASE'
}
repositories {
mavenCentral()
@@ -34,23 +32,9 @@ dependencies {
testCompile('com.typesafe.akka:akka-testkit_2.12:2.4.19')
}
task replaceTokens(type: Copy) {
def finalBuildName = project.name + '-' + project.version
from 'src/main/docker'
into 'build/docker'
filter(ReplaceTokens, tokens:
['project.build.finalName': finalBuildName,
"TELEGRAM_TOKEN" : System.getenv()['TELEGRAM_TOKEN'],
"SECURITY_SECRET" : System.getenv()['SECURITY_SECRET']
])
}
task copyJar(type: Copy) {
task prepare(type: Copy) {
dependsOn assemble
from file("${project.buildDir}/libs")
into file("${project.buildDir}/docker")
into file("${project.rootDir}/docker")
}
task makeDockerFile(type: Copy, dependsOn: [replaceTokens, copyJar])

View File

@@ -1,2 +0,0 @@
TELEGRAM_TOKEN=@TELEGRAM_TOKEN@
SECURITY_SECRET=@SECURITY_SECRET@

View File

@@ -18,7 +18,7 @@ banner:
location: "classpath:/banner.txt"
logging:
file: log/app.log
file: /lbs/log/app.log
level:
com.lbs: DEBUG
# org.hibernate.SQL: DEBUG