Skip to content

fix: musl(Alpine)で静的ビルドし外部HTTPS通信を復旧 - #47

Merged
limit7412 merged 1 commit into
masterfrom
claude/github-notifications-slack-pr89-vzpjgu
Jul 4, 2026
Merged

limit7412 merged 1 commit into
masterfrom
claude/github-notifications-slack-pr89-vzpjgu

Conversation

@limit7412

Copy link
Copy Markdown
Owner

概要

本家 github_notifications_slack#89 の修正を本リポジトリ(Crystal 版)へ適用します。

背景・問題

  • glibc で静的リンクしたバイナリは Lambda の provided.al2023 ランタイム上で外部 HTTPS 通信に失敗する(OpenSSL の初期化エラー: unregistered scheme)。
  • そのため api.github.com / hooks.slack.com へ到達できず、Slack 通知が届かない状態になっていた。

変更内容

serverless.yml のビルドフック(before:package:createDeploymentArtifacts)を変更:

  • ビルドベースイメージを crystallang/crystal:latest(glibc)→ crystallang/crystal:latest-alpine(musl)へ切り替え。musl ベースの静的バイナリでは外部 HTTPS 通信が正常に動作する。
  • 静的リンクに必要なライブラリ(openssl-libs-static / zlib-static / libevent-static)を apk add --no-cache で明示導入し、ベースイメージ更新時のリンク失敗を防止。
-        docker run --rm --platform linux/arm64 -v "$PWD":/work -w /work crystallang/crystal:latest \
-          sh -c "crystal build --link-flags -static -o bootstrap src/main.cr && chmod +x bootstrap"
+        docker run --rm --platform linux/arm64 -v "$PWD":/work -w /work crystallang/crystal:latest-alpine \
+          sh -c "apk add --no-cache openssl-libs-static zlib-static libevent-static && crystal build --link-flags -static -o bootstrap src/main.cr && chmod +x bootstrap"

あわせて、上記の理由を説明するコメントを serverless.yml に追記しています。

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ncf7NZnj7J6EnqDBCBr7RD


Generated by Claude Code

glibc で静的リンクしたバイナリは provided.al2023 上で外部 HTTPS 通信に
失敗し(OpenSSL 初期化エラー)、api.github.com / hooks.slack.com へ到達
できなかった。ビルドベースを crystallang/crystal:latest-alpine(musl)へ
切り替え、静的リンク用ライブラリ(openssl-libs-static / zlib-static /
libevent-static)を apk add で明示導入することで外部通信を復旧する。

github_notifications_slack#89 を本リポジトリに適用。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ncf7NZnj7J6EnqDBCBr7RD
@limit7412
limit7412 marked this pull request as ready for review July 4, 2026 06:06

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Docker build step in serverless.yml to use an Alpine-based Crystal image and installs static libraries to fix HTTPS communication issues on AWS Lambda's provided.al2023 runtime. The review feedback recommends pinning the Docker image version instead of using latest-alpine to ensure build reproducibility, and changing the ownership of the generated bootstrap binary back to the host user to avoid permission issues during cleanup or caching.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread serverless.yml
Comment thread serverless.yml
@limit7412
limit7412 merged commit f311660 into master Jul 4, 2026
2 checks passed
@limit7412
limit7412 deleted the claude/github-notifications-slack-pr89-vzpjgu branch July 4, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants