Upgrade to Pro — share decks privately, control downloads, hide ads and more …

さくらのクラウド AppRun と GitHub Actions でお手軽サーバレス構築

Avatar for cyokozai cyokozai
October 27, 2025

さくらのクラウド AppRun と GitHub Actions でお手軽サーバレス構築

さくらのクラウドの新しいアプリケーション実行基盤である「AppRun(ベータ版)」を使用して、サーバレスアプリケーションを構築する方法を解説する

Avatar for cyokozai

cyokozai

October 27, 2025
Tweet

More Decks by cyokozai

Other Decks in Technology

Transcript

  1. コンテナレジストリにイメージをプッシュ # CRにログイン docker login kubeconformserver.sakuracr.jp # イメージをbuildする docker build

    -f Dockerfile -t kubeconformserver.sakuracr.jp/kubeconformserver:latest . # sakuracr.jpにpushする docker push kubeconformserver.sakuracr.jp/kubeconformserver:latest
  2. Q. DockerHubを直接使いたいんだけど....? • AppRun βで利用できるコンテナレジストリはさくらのクラウドが 提供しているコンテナレジストリ (OCI準拠) のみ • DockerHubやGitHub

    Container Registoryのイメージを使用する場合は、 一度ローカルにPullした上でさくらのクラウドにPushする必要がある
  3. 各種設定 さくらのコンテナ レジストリからPull 認証情報の設定 vCPU使用量の上限 (0.1~1 コア) メモリー使用量の上限 (256MiB~2GiB) アプリケーション名

    ポート番号 ヘルスチェックの設定 (10秒ごとの監視) 環境変数の定義 インスタンス数の 自動調整範囲 同時リクエスト数 リクエストタイムアウト https://manual.sakura.ad.jp/cloud/apprun/glossary.html
  4. ワークフロー name: Kubeconformserver - Sacloud AppRun Actions on: push: branches:

    - main workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Deployment id: deploy uses: ippanpeople/[email protected] with: use-repository-dockerfile: true app-dir: ./src sakura-api-key: ${{ secrets.SAKURA_API_KEY }} sakura-api-secret: ${{ secrets.SAKURA_API_SECRET }} container-registry: ${{ secrets.REGISTRY }} container-registry-user: ${{ secrets.REGISTRY_USER }} container-registry-password: ${{ secrets.REGISTRY_PASSWORD }} port: '8080'
  5. Name Value REGISTRY コンテナレジストリの URL REGISTRY_USER コンテナレジストリのユーザー名 REGISTRY_PASSWORD コンテナレジストリのパスワード SAKURA_API_KEY

    さくらの API キー SAKURA_API_SECRET さくらの API シークレット STORAGE_BUCKET_NAME オブジェクトストレージのバケット名 STORAGE_ACCESS_KEY オブジェクトストレージのアクセスキー STORAGE_SECRET_KEY KEY オブジェクトストレージのシークレットキー GitHubにシークレットを登録 リポジトリのSettings > Secrets and variablesから各種設定を入力