Add Dockerfile and CI Docker build stage

Update CI script

Added Docker DIND

Updated CI and Dockerfile

Another CI update
This commit is contained in:
Yamato 2020-07-02 16:12:34 +00:00 committed by carbotaniuman
parent f77ed40b5b
commit 27465df728
2 changed files with 26 additions and 5 deletions

View file

@ -1,7 +1,7 @@
image: "alpine"
stages: stages:
- build - build
- publish - publish
- publish_docker
cache: cache:
paths: paths:
@ -19,14 +19,29 @@ publish:
only: only:
- tags - tags
before_script: before_script:
- apk update - apk update && apk add git zip
- apk add git zip
script:
- export VERSION=`git describe --tags --dirty` - export VERSION=`git describe --tags --dirty`
script:
- cp build/libs/mangadex_at_home-${VERSION}-all.jar ./ - 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 - zip -r9 mangadex_at_home-${VERSION}.zip mangadex_at_home-${VERSION}-all.jar settings.sample.json
artifacts: artifacts:
name: "mangadex_at_home-${CI_COMMIT_TAG}" name: "mangadex_at_home"
paths: paths:
- "*.jar" - "*.jar"
- settings.sample.json - 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

6
Dockerfile Normal file
View file

@ -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