From fa3d53f4ccf2f82a7392fb00c7f1c7c11ce876a6 Mon Sep 17 00:00:00 2001 From: inductor Date: Fri, 9 Jun 2023 14:20:32 +0900 Subject: [PATCH] use jdk 17 --- .../publish-seichiassist-builder-v2.yml | 51 +++++++++++++++++++ .../publish-seichiassist-runner-v2.yml | 51 +++++++++++++++++++ seichiassist-builder-v2/Dockerfile | 18 +++++++ seichiassist-runner-v2/Dockerfile | 5 ++ 4 files changed, 125 insertions(+) create mode 100644 .github/workflows/publish-seichiassist-builder-v2.yml create mode 100644 .github/workflows/publish-seichiassist-runner-v2.yml create mode 100644 seichiassist-builder-v2/Dockerfile create mode 100644 seichiassist-runner-v2/Dockerfile diff --git a/.github/workflows/publish-seichiassist-builder-v2.yml b/.github/workflows/publish-seichiassist-builder-v2.yml new file mode 100644 index 0000000..693a85d --- /dev/null +++ b/.github/workflows/publish-seichiassist-builder-v2.yml @@ -0,0 +1,51 @@ +name: Build and publish seichiassist-builder docker image +on: + push: + branches: + - main + paths: + - 'seichiassist-builder-v2/**' + - '.github/workflows/publish-seichiassist-builder-v2.yml' + +jobs: + build-and-push: + runs-on: ubuntu-latest + env: + image_name: seichiassist-builder-v2 + + # 参考: https://qiita.com/kawakawaryuryu/items/b0291c1bc1141a535263 + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - id: prepare_image_id + name: Prepare image id's components + run: | + lowercase_id=ghcr.io/${{ github.repository_owner }}/${{ env.image_name }} + echo "::set-output name=lowercase_id::$(echo $lowercase_id | tr '[A-Z]' '[a-z]')" + echo "::set-output name=short-ref::$(git rev-parse --short "$GITHUB_SHA")" + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: ./seichiassist-builder-v2 + builder: ${{ steps.buildx.outputs.name }} + push: true + tags: | + ${{ steps.prepare_image_id.outputs.lowercase_id }}:latest + ${{ steps.prepare_image_id.outputs.lowercase_id }}:${{ steps.prepare_image_id.outputs.short-ref }} + cache-from: type=gha + # すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max + cache-to: type=gha,mode=max diff --git a/.github/workflows/publish-seichiassist-runner-v2.yml b/.github/workflows/publish-seichiassist-runner-v2.yml new file mode 100644 index 0000000..4d83c88 --- /dev/null +++ b/.github/workflows/publish-seichiassist-runner-v2.yml @@ -0,0 +1,51 @@ +name: Build and publish seichiassist-runner docker image +on: + push: + branches: + - main + paths: + - 'seichiassist-runner-v2/**' + - '.github/workflows/publish-seichiassist-runner-v2.yml' + +jobs: + build-and-push: + runs-on: ubuntu-latest + env: + image_name: seichiassist-runner-v2 + + # 参考: https://qiita.com/kawakawaryuryu/items/b0291c1bc1141a535263 + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - id: prepare_image_id + name: Prepare image id's components + run: | + lowercase_id=ghcr.io/${{ github.repository_owner }}/${{ env.image_name }} + echo "::set-output name=lowercase_id::$(echo $lowercase_id | tr '[A-Z]' '[a-z]')" + echo "::set-output name=short-ref::$(git rev-parse --short "$GITHUB_SHA")" + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: ./seichiassist-runner-v2 + builder: ${{ steps.buildx.outputs.name }} + push: true + tags: | + ${{ steps.prepare_image_id.outputs.lowercase_id }}:latest + ${{ steps.prepare_image_id.outputs.lowercase_id }}:${{ steps.prepare_image_id.outputs.short-ref }} + cache-from: type=gha + # すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max + cache-to: type=gha,mode=max diff --git a/seichiassist-builder-v2/Dockerfile b/seichiassist-builder-v2/Dockerfile new file mode 100644 index 0000000..331b42f --- /dev/null +++ b/seichiassist-builder-v2/Dockerfile @@ -0,0 +1,18 @@ +FROM eclipse-temurin:17.0.7_7-jdk-jammy + +# sbt をインストールする (https://www.scala-sbt.org/1.x/docs/ja/Installing-sbt-on-Linux.html) +RUN apt-get update && apt-get install -y apt-transport-https curl gnupg + +RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list +RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list +RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" \ + | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import +RUN chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg + +RUN apt-get update && apt-get install -y sbt=1.9.0 + +# sbt launcherがsbtをDLしてくれる +RUN sbt --version + +# eclipse-temurin にはgitがインストールされておらず、CIの利用には不便 +RUN apt-get install -y git diff --git a/seichiassist-runner-v2/Dockerfile b/seichiassist-runner-v2/Dockerfile new file mode 100644 index 0000000..742ebe1 --- /dev/null +++ b/seichiassist-runner-v2/Dockerfile @@ -0,0 +1,5 @@ +FROM eclipse-temurin:17.0.7_7-jdk-jammy + +RUN apt-get update && apt-get install nkf +ADD https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 /usr/bin/yq +RUN chmod +x /usr/bin/yq