From 19059e02b5f439e5bc8a758bf7506c9d7f17f41a Mon Sep 17 00:00:00 2001 From: Rostislav Raykov Date: Tue, 8 Oct 2024 23:57:24 +0300 Subject: [PATCH] updating the Dockerfile and the Jenkinsfile so the db, logs and files stay outside the docker container --- Dockerfile | 2 ++ Jenkinsfile | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 67a50d8..cc16c34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ WORKDIR /app COPY ${WORKSPACE}/target/quickdrop-0.0.1-SNAPSHOT.jar /app/quickdrop.jar +VOLUME ["/app/db", "/app/log", "/files"] + EXPOSE 8080 ENTRYPOINT ["java", "-jar", "/app/quickdrop.jar"] diff --git a/Jenkinsfile b/Jenkinsfile index b482f32..f46ec58 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,14 +41,20 @@ pipeline { } stage('Run New Container') { - steps { - script { - sh """ - docker run -d --name ${CONTAINER_NAME} -p 8083:8080 ${DOCKER_IMAGE} - """ + steps { + script { + // Updated volume mappings with standard directories + sh """ + docker run -d --name ${CONTAINER_NAME} \ + -p 8083:8080 \ + -v /var/lib/quickdrop/db:/app/db \ + -v /var/log/quickdrop:/app/log \ + -v /srv/quickdrop/files:/files \ + ${DOCKER_IMAGE} + """ + } + } } - } - } } post {