From e12dc66bca6532c56d0118698e6cb4c901bd5827 Mon Sep 17 00:00:00 2001 From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de> Date: Fri, 10 Jun 2022 20:10:24 +0200 Subject: [PATCH] build docker image --- .gitlab-ci.yml | 18 ++++++++++++++++++ Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6208b40..35b007c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ variables: MAVEN_DEPLOY_OPTS: "--settings=$MAVEN_SETTINGS_PATH" # File for storing the POM project.version VARIABLES_FILE: ./variables.txt + CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA ################### ### TEMPLATES ### @@ -31,6 +32,10 @@ variables: - 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X PUT -H "Content-Type: application/json" --data "{}" ${APTLY_URL}/publish/:./indy' - fi +.kaniko-setup_template: &kaniko-setup + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json + stages: - build_version - deploy_java @@ -79,6 +84,19 @@ build_and_deploy: name: WEBAPP_DEB_PACKAGES paths: - ./target/*.deb + +build_container: + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + stage: build + before_script: + - *kaniko-setup + script: + - /kaniko/executor + --context $CI_PROJECT_DIR + --dockerfile $CI_PROJECT_DIR/Dockerfile + --destination $CONTAINER_IMAGE # Deploy DEB files to APTLY repository. # All four DEB files are deployed with SNAPSHOT version (branch: develop)! diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dfc0539 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM maven:3-jdk-8 as builder + +COPY . /build +WORKDIR /build +RUN mvn package -Dmaven.test.skip=true -P \!textgrid.deb + + +FROM tomcat:8-jdk8-openjdk-slim-bullseye + +# latex for PDF generation (TODO: test if PDF generation is really working, otherwise safe that space) +RUN apt-get update -y && apt-get upgrade -y && apt-get install --no-install-recommends -y \ + #texlive-xetex \ + texlive-latex-base \ + texlive-latex-extra \ + texlive-plain-generic \ + # save some space + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /build/target/aggregator-*.war /usr/local/tomcat/webapps/aggregator.war + -- GitLab