From 26ba723fad106bda3729ecd4ffce76ce2ad60805 Mon Sep 17 00:00:00 2001 From: Sonia Zorba <sonia.zorba@inaf.it> Date: Mon, 21 Dec 2020 10:40:12 +0100 Subject: [PATCH] Dockerization --- .gitlab-ci.yml | 27 +++++++++++++++++++++++++++ Dockerfile | 4 ++++ pom.xml | 2 ++ 3 files changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f71f65..67a0d0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ stages: + - build - generate-test-env - test - dockerize @@ -7,6 +8,20 @@ variables: # to avoid "fatal: git fetch-pack: expected shallow list" GIT_STRATEGY: clone +build: + stage: build + tags: + - docker + only: + refs: + - ci-test + script: + - mvn clean package -DskipTests -DfinalName=vospace + artifacts: + paths: + - target/vospace.jar + expire_in: 7 days + pre_test: stage: generate-test-env tags: @@ -37,3 +52,15 @@ test: coverage: '/coverage=\d+\.\d+/' only: - ci-test + +dockerize: + stage: dockerize + tags: + - shell + only: + refs: + - ci-test + script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker build -t $CI_REGISTRY_IMAGE . + - docker push $CI_REGISTRY_IMAGE diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..034193f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:14-jdk-alpine +ARG JAR_FILE=target/vospace.jar +COPY ${JAR_FILE} vospace.jar +ENTRYPOINT ["java","-jar","/vospace.jar"] diff --git a/pom.xml b/pom.xml index de3a2fb..4acaeee 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ <java.version>11</java.version> <!-- File catalog repository directory --> <init_database_scripts_path>../../../vospace-file-catalog</init_database_scripts_path> + <finalName>${project.artifactId}-${project.version}</finalName> </properties> <dependencies> @@ -114,6 +115,7 @@ </repositories> <build> + <finalName>${finalName}</finalName> <testResources> <testResource> <directory>src/test/resources</directory> -- GitLab