Skip to content

Commit

Permalink
use jdk 17
Browse files Browse the repository at this point in the history
  • Loading branch information
inductor committed Jun 9, 2023
1 parent d5bb64b commit fa3d53f
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/publish-seichiassist-builder-v2.yml
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions .github/workflows/publish-seichiassist-runner-v2.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions seichiassist-builder-v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions seichiassist-runner-v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fa3d53f

Please sign in to comment.