diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c51bbf3..a6ce33b 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ -image: "alpine" stages: - build - publish + - publish_docker cache: paths: @@ -19,14 +19,29 @@ publish: only: - tags before_script: - - apk update - - apk add git zip - script: + - apk update && apk add git zip - export VERSION=`git describe --tags --dirty` + script: - cp build/libs/mangadex_at_home-${VERSION}-all.jar ./ - zip -r9 mangadex_at_home-${VERSION}.zip mangadex_at_home-${VERSION}-all.jar settings.sample.json artifacts: - name: "mangadex_at_home-${CI_COMMIT_TAG}" + name: "mangadex_at_home" paths: - "*.jar" - settings.sample.json + +publish_docker: + image: docker:git + stage: publish + only: + - tags + services: + - docker:dind + before_script: + - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin ${CI_REGISTRY} + - export VERSION=`git describe --tags --dirty` + script: + - mv build/libs/mangadex_at_home-${VERSION}-all.jar build/libs/mangadex_at_home.jar + - docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:latest . + - docker push ${CI_REGISTRY_IMAGE}:${VERSION} + - docker push ${CI_REGISTRY_IMAGE}:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..422bed9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM openjdk:15-alpine +WORKDIR /mangahome +COPY /build/libs/mangadex_at_home.jar . +VOLUME "/mangahome/cache" +EXPOSE 443 8080 +CMD java -Dfile-level=off -Dstdout-level=trace -jar mangadex_at_home.jar \ No newline at end of file