diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..251616a87cb7cd127c0407b30276e042626912bb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +stages: + - test + - dockerize + +test: + stage: test + tags: + - docker + script: + - mvn clean test + - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print "coverage=" 100*covered/instructions }' target/site/jacoco/jacoco.csv + coverage: '/coverage=\d+\.\d+/' + only: + - master + +deploy: + stage: dockerize + tags: + - shell + only: + - master + 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 0000000000000000000000000000000000000000..824a8cb08abae1d1783b195371a422dc48b6e8c9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM maven:3.6.3-openjdk-14 + +ADD src /src +ADD pom.xml . + +RUN mvn clean package -DskipTests -DfinalName=vospace-file-service + +FROM openjdk:14-jdk-alpine +COPY --from=0 /target/vospace-file-service.jar /vospace-file-service.jar + +ENTRYPOINT ["java","-jar","/vospace-file-service.jar"] diff --git a/README.md b/README.md index 0d6e18203e6307a5a12ce8f3dc206f7cf3b0ab3f..0cdfe8396137bce13cc97fce64ca66bf2ce8c1e8 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,9 @@ This service queries the same database used by VOSpace (`file_catalog`). It provides functionalities for downloading and uploading files. + +## Running with Docker + +See `docker-env` file for configuration + + docker run -it --env-file docker-env -v "/path/to/userspace:/tmp/fsdemo" -p 8080:8080 git.ia2.inaf.it:5050/ia2/vospace-file-service diff --git a/docker-env b/docker-env new file mode 100644 index 0000000000000000000000000000000000000000..0562a6668e63697a4b158a221c0c0e8e3ca1adce --- /dev/null +++ b/docker-env @@ -0,0 +1,8 @@ +path_prefix=/tmp/fsdemo + +file-catalog.datasource.jdbc-url=jdbc:postgresql://172.19.0.1:5432/vospace_testdb +file-catalog.datasource.username=postgres +file-catalog.datasource.password= + +gms_base_url=https://sso.ia2.inaf.it/gms +jwks_uri=https://sso.ia2.inaf.it/rap-ia2/auth/oidc/jwks diff --git a/pom.xml b/pom.xml index a7ee15fe18a06d820e3ec908f3f898f485aa1819..4d9233328d5785ceb9a08fc9450886002f7f01fd 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ 14 + ${project.artifactId}-${project.version} @@ -58,11 +59,46 @@ + + + ia2-snapshots + your custom repo + http://repo.ia2.inaf.it/maven/repository/snapshots + + + - + ${finalName} + + + maven-surefire-plugin + 2.22.2 + org.springframework.boot spring-boot-maven-plugin + + true + + + + org.jacoco + jacoco-maven-plugin + 0.8.6 + + + + prepare-agent + + + + report + test + + report + + +