Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.1] docker build が失敗する #504

Closed
yuicho opened this issue Jan 25, 2024 · 5 comments · Fixed by #507
Closed

[10.1] docker build が失敗する #504

yuicho opened this issue Jan 25, 2024 · 5 comments · Fixed by #507
Labels
bug Something isn't working
Milestone

Comments

@yuicho
Copy link

yuicho commented Jan 25, 2024

バグの再現手順

  1. git fetch で全コミット取り込む
  2. git checkout kb10.1 でkb10.1のtagに切り替え
  3. docker build -t kmyblue:kb10.1 . でimageをbuild

期待する動作

buildが成功する

実際の動作

下記のエラーが発生してbuild失敗

Dockerfile:15
--------------------
  13 |     FROM docker.io/node:${NODE_MAJOR_VERSION}-${DEBIAN_VERSION}-slim as node
  14 |     # Ruby image to use for base image based on combined variables (ex: 3.2.2-slim-bookworm)
  15 | >>> FROM docker.io/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} as ruby
  16 |     
  17 |     # Resulting version string is vX.X.X-MASTODON_VERSION_PRERELEASE+MASTODON_VERSION_METADATA
--------------------
ERROR: failed to solve: failed to parse stage name "docker.io/ruby:-slim-": invalid reference format

詳しい情報

No response

バグが発生したkmyblueサーバーのドメイン

mstdn.yuicho.net

バグが発生したkmyblueのバージョン

10.1

ブラウザの名前

No response

OS

No response

その他の詳細情報

LTSに関しては問題なくbuildできることを確認しました

@yuicho yuicho added the bug Something isn't working label Jan 25, 2024
@yuicho
Copy link
Author

yuicho commented Jan 25, 2024

Dockerfileは、Upstreamのstableと開発版の間でリファクタリングが行われています。
そのため、rubyバージョン変更のコミットがstableと開発版の両方で存在していて、stable用のバージョン変更コミットが用いられたことでDockerfileの記載内容に不整合が起こりエラーとなったようです。

なお、stableのrubyバージョン変更コミットが fcb0ebd 、開発版のrubyバージョン変更コミットが 5efb00d です。

@yuicho
Copy link
Author

yuicho commented Jan 25, 2024

試しにcommit戻して開発版の方取り込んだら問題なくbuildできることを確認しました(が、この方法でいいのか自信なかったのでPRにはしてません…🙏)

# git restore -s c652b0e46b6655366d976e8e18b92c63b734b91b Dockerfile
# git checkout kb_development -- Dockerfile

以下は上記コマンド後の差分です

@@ -1,17 +1,21 @@
 # syntax=docker/dockerfile:1.4
 
-FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.3-slim as ruby
-FROM node:${NODE_VERSION} as build
-
-# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.2.2"]
-ARG RUBY_VERSION="3.2.2"
+# Please see https://docs.docker.com/engine/reference/builder for information about
+# the extended buildx capabilities used in this file.
+# Make sure multiarch TARGETPLATFORM is available for interpolation
+# See: https://docs.docker.com/build/building/multi-platform/
+ARG TARGETPLATFORM=${TARGETPLATFORM}
+ARG BUILDPLATFORM=${BUILDPLATFORM}
+
+# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.2.3"]
+ARG RUBY_VERSION="3.2.3"
 # # Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="20"]
 ARG NODE_MAJOR_VERSION="20"
 # Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="bookworm"]
 ARG DEBIAN_VERSION="bookworm"
 # Node image to use for base image based on combined variables (ex: 20-bookworm-slim)
 FROM docker.io/node:${NODE_MAJOR_VERSION}-${DEBIAN_VERSION}-slim as node
-# Ruby image to use for base image based on combined variables (ex: 3.2.2-slim-bookworm)
+# Ruby image to use for base image based on combined variables (ex: 3.2.3-slim-bookworm)
 FROM docker.io/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} as ruby
 
 # Resulting version string is vX.X.X-MASTODON_VERSION_PRERELEASE+MASTODON_VERSION_METADATA

@kmycode
Copy link
Owner

kmycode commented Jan 25, 2024

10.1リリース時に以下のコミットをチェリーピックしたのが原因のようです

fcb0ebd
これは4.2.4向けのコミットであり、開発版のリファクタリングが反映されていません。

mastodon@5efb00d
こちらをチェリーピックするのが正解だったようです。

本家に追従する関係上、少なくとも11.0までに取り込むことはできそうです。今すぐで大丈夫ならそうしますが、自信ないと言われると少し怖いですね。

@yuicho
Copy link
Author

yuicho commented Jan 26, 2024

言葉足らずで申し訳ありません。

自信がないのはgitの扱いなので、Dockerファイルとしては「4.2.4向けのチェリーピック前に戻し、開発版向けをチェリーピックする」で問題ありません
(build及び動作確認済みです)

ただ、いずれにせよcomposeファイルにも問題があり(#485)簡単には扱えない状態ではありますので、「11までにfixする」でも良いのではと思います

@kmycode
Copy link
Owner

kmycode commented Jan 26, 2024

チェリーピック先は10.1のリリースだけでして、うちの開発版(kb_development)には反映されていません。
開発版のDockerfileは現在、Mastodon本家の開発版(main)と同一になっています。
#485 はうちの開発版(kb_development)へのPRなので、今回の問題とは関係ないです。

ですので11.0をリリースすることで問題は改善されますが、10.1のリリースはreleases/10ブランチにありますので、このブランチ内のDockerfileを修正する必要はあります。
10.2を出す機会がもしあれば、これも一緒に対応します

@kmycode kmycode added this to the kb10.2 milestone Jan 26, 2024
@kmycode kmycode mentioned this issue Jan 26, 2024
@kmycode kmycode linked a pull request Jan 26, 2024 that will close this issue
@kmycode kmycode closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants