gateway(nginx) + manager(python 標準ライブラリ) + セッションごとの使い捨て Pod + reaper CronJob の構成。ブラウザ(PC/スマホ)からアクセスし、セッション単位で 独立した Alpine コンテナに Git リポジトリ(GitHub/Gitea など)をチェックアウトして 編集・検証・プッシュする。無操作が続いたセッションは Pod ごと自動破棄。 - セキュリティ: セッション NS 分離 / restricted PodSecurity / RBAC はセッション NS の pods,services のみの Role / セッション Pod は SA トークン非マウント・非 root・ readOnlyRootFilesystem・drop ALL caps・seccomp / NetworkPolicy で egress を DNS+HTTPS+SSH に限定 / Git ホスト allow-list / ResourceQuota+LimitRange - ライフサイクル: idleTimeout(Pod 内ウォッチドッグ + manager 回収) / maxLifetime (activeDeadlineSeconds) / maxSessions / 予備の孤児掃除 CronJob - 認証: token(既定) / basic / forward(外部SSO) / none。WebSocket は Cookie トークン - Claude 認証: ANTHROPIC_API_KEY または CLAUDE_CODE_OAUTH_TOKEN - CI: helm-release.yaml(未リリース版のみ tag+release+publish) / image-update-and-release.yaml(週次 npm 追従) / session-image.yaml(multi-arch build) - files/ 実体を .Files.Get で ConfigMap 化。helm lint / template 検証済み
77 lines
2.4 KiB
YAML
77 lines
2.4 KiB
YAML
name: Build Session Image
|
||
|
||
# セッション用の事前ビルドイメージ(git + openssh + ttyd + node + @anthropic-ai/claude-code)を
|
||
# linux/amd64 + linux/arm64 でビルドし、Gitea Container Registry へ push する。
|
||
#
|
||
# トリガー:
|
||
# - files/Dockerfile.session / files/session-entrypoint.sh / Chart.yaml の変更 push
|
||
# (image-update-and-release.yaml が Chart.yaml を更新した後にも発火する)
|
||
# - 手動実行(tag を任意指定可能)
|
||
#
|
||
# タグ: Chart.yaml の appVersion(= Claude Code CLI バージョン) と latest。
|
||
|
||
on:
|
||
push:
|
||
branches: [main, master]
|
||
paths:
|
||
- 'files/Dockerfile.session'
|
||
- 'files/session-entrypoint.sh'
|
||
- 'Chart.yaml'
|
||
- '.gitea/workflows/session-image.yaml'
|
||
workflow_dispatch:
|
||
inputs:
|
||
tag:
|
||
description: 'イメージタグ(未指定なら Chart.yaml の appVersion)'
|
||
required: false
|
||
|
||
env:
|
||
REGISTRY_HOST: git.cafepieters.com
|
||
IMAGE: git.cafepieters.com/helmchart/claude-code/session
|
||
|
||
jobs:
|
||
build-push:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v3
|
||
|
||
- name: Resolve tag
|
||
id: t
|
||
run: |
|
||
set -e
|
||
TAG="${{ github.event.inputs.tag }}"
|
||
[ -n "$TAG" ] || TAG=$(grep '^appVersion:' Chart.yaml | sed 's/.*"\(.*\)".*/\1/')
|
||
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||
echo "Session image tag: $TAG"
|
||
|
||
- name: Set up QEMU
|
||
uses: docker/setup-qemu-action@v3
|
||
|
||
- name: Set up Buildx
|
||
uses: docker/setup-buildx-action@v3
|
||
|
||
- name: Login to Gitea Container Registry
|
||
uses: docker/login-action@v3
|
||
with:
|
||
registry: ${{ env.REGISTRY_HOST }}
|
||
username: ${{ secrets.REGISTRY_USER }}
|
||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||
|
||
- name: Build & push (multi-arch)
|
||
uses: docker/build-push-action@v6
|
||
with:
|
||
context: .
|
||
file: files/Dockerfile.session
|
||
platforms: linux/amd64,linux/arm64
|
||
build-args: |
|
||
CLAUDE_CODE_VERSION=${{ steps.t.outputs.tag }}
|
||
tags: |
|
||
${{ env.IMAGE }}:${{ steps.t.outputs.tag }}
|
||
${{ env.IMAGE }}:latest
|
||
push: true
|
||
provenance: false
|
||
|
||
- name: Summary
|
||
run: |
|
||
echo "pushed ${IMAGE}:${{ steps.t.outputs.tag }} (+ latest) for linux/amd64,linux/arm64"
|