From 11a1360bf94d3d49825423e9193afbef6b63d465 Mon Sep 17 00:00:00 2001 From: Joel Lappalainen Date: Tue, 30 Jul 2024 16:37:41 +0300 Subject: [PATCH 1/7] Add initial jib setup --- .github/workflows/dev-pipeline.yml | 34 ++++++++++++++------- pom.xml | 48 ++++++++++++++++++++++++++++++ src/main/jib/docker-entrypoint.sh | 3 ++ 3 files changed, 75 insertions(+), 10 deletions(-) create mode 100755 src/main/jib/docker-entrypoint.sh diff --git a/.github/workflows/dev-pipeline.yml b/.github/workflows/dev-pipeline.yml index 9bf5d0c24a9..b2a59f82848 100644 --- a/.github/workflows/dev-pipeline.yml +++ b/.github/workflows/dev-pipeline.yml @@ -3,18 +3,32 @@ on: push: branches: - dev-1.x - pull_request: - branches: - - dev-1.x + - jib-refactor-otp1 jobs: docker-push: - if: github.ref == 'refs/heads/dev-1.x' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build docker image from dev-1.x and push it - run: ./.github/workflows/scripts/build_and_push_dev.sh + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: adopt + cache: maven + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Build container image with Jib, push to Dockerhub env: - DOCKER_USER: ${{ secrets.DOCKER_USER }} - DOCKER_AUTH: ${{ secrets.DOCKER_AUTH }} + CONTAINER_REPO: docker.io/hsldevcom/opentripplanner:jib-testing-v1 + CONTAINER_REGISTRY_USER: ${{ secrets.DOCKER_USER }} + CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_AUTH }} + run: | + otp_version="jib-testing-v1" + commit_hash=`git rev-parse --short "$GITHUB_SHA"` + date_time=`date +"%Y-%m-%dT%H-%M-%S"` + docker_tag_long="$otp_version-$date_time-$commit_hash" + + mvn --batch-mode -P prettierSkip compile com.google.cloud.tools:jib-maven-plugin:build -Djib.to.tags=$docker_tag_long diff --git a/pom.xml b/pom.xml index 1cc7c32f1c9..fc60b17b802 100644 --- a/pom.xml +++ b/pom.xml @@ -296,6 +296,54 @@ false + + com.google.cloud.tools + jib-maven-plugin + 3.4.3 + + + org.opentripplanner.standalone.OTPMain + /docker-entrypoint.sh + + + /var/opentripplanner/ + + + + 8080 + 8081 + + + + openjdk:8u121-jre + + + amd64 + linux + + + + + ${env.CONTAINER_REPO} + + ${env.CONTAINER_REGISTRY_USER} + ${env.CONTAINER_REGISTRY_PASSWORD} + + + + + + /docker-entrypoint.sh + 755 + + + /var/opentripplanner/ + 755 + + + + +