Commit 11c0e917 by amir

add docker compose run

parent b2a3a338
Showing with 38 additions and 6 deletions
No preview for this file type
FROM 172.16.1.132:5000/ipgallery/base-microservice-java FROM 172.16.1.132:5000/ipgallery/base-microservice-java
#RUN mkdir -p /opt/mcx/config
#RUN mkdir -p /logs/conf
COPY build/libs/LocationService-*.jar /usr/ COPY build/libs/LocationService-*.jar /usr/
COPY cfg/config.properties /opt/mcx/config/ COPY cfg/config.properties /opt/mcx/config/
#COPY cfg/log4j.xml /logs/conf/
#COPY script/run.sh /usr/
RUN chmod +x /usr/run.sh RUN chmod +x /usr/run.sh
RUN mv /usr/LocationService-*.jar /usr/LocationService.jar RUN mv /usr/LocationService-*.jar /usr/LocationService.jar
WORKDIR /usr WORKDIR /usr
EXPOSE 32015 #EXPOSE 32015
ENTRYPOINT ["/usr/run.sh","/usr/LocationService.jar"] ENTRYPOINT ["/usr/run.sh","/usr/LocationService.jar"]
\ No newline at end of file
...@@ -32,6 +32,40 @@ jar { ...@@ -32,6 +32,40 @@ jar {
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
} }
task buildDockerImage(type:Exec) {
dependsOn jar
mustRunAfter jar
println 'building docker image'
def commandWirhArgs = [ "docker" ,"build","-t", "172.16.1.132.5000/ipgallery/location-service", "."]
commandLine commandWirhArgs
}
task stopDockerCompose(type:Exec) {
//dependsOn buildDockerImage
//mustRunAfter buildDockerImage
println 'stopping docker compose...'
def commandWirhArgs = [ "docker-compose" ,"stop"]
commandLine commandWirhArgs
}
task removeDockerCompose(type:Exec) {
dependsOn stopDockerCompose
mustRunAfter stopDockerCompose
println 'removing docker compose...'
def commandWirhArgs = [ "docker-compose" ,"rm","--force"]
commandLine commandWirhArgs
}
task runDockerCompose(type:Exec) {
dependsOn jar
mustRunAfter jar
println 'running docker compose...'
// if you want to run in background add "-d"
// if you want to see logs run without -d
def commandWirhArgs = [ "docker-compose" ,"up","--force-recreate","-d"]
commandLine commandWirhArgs
}
publishing { publishing {
publications { publications {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment