Psych gem build error `yaml.h not found` and followup

All of a sudden my build step was failing with the following

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
  
    current directory: /usr/local/bundle/ruby/3.4.0/gems/psych-5.2.2/ext/psych
/usr/local/bin/ruby extconf.rb
checking for pkg-config for yaml-0.1... not found
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Psych is a YAML Ruby gem and relies on libyaml and yaml.h not found looks like a missing dependency. If FROM docker.io/library/ruby:$RUBY_VERSION-slim is similar to your Dockerfile, all you need is to add libyaml-dev where ever you’re installing dependencies for a build phase.

What I’d love to know is why this appears to have happened without a change on my end and how I can be informed of another similar change.

Hi @agrberg,

It’s not necessarily related to our changes. Some of your dependencies could change too.
What’s your service ID? I will take a closer look.

My original post was unclear, I don’t think this is related to Koyeb at all.

I actually managed to track it down. It appears libyaml-dev was removed from the Ruby slim and alpine images two days ago, when this started happening. There’s a lot more information in that GH issue. I kind of got lucky as I was looking for the Rails Dockerfile template and noticed libyaml-dev is now included!

In answer to how can I be informed, it appears that’s a lot of the discussion on the GH issue page. In answer to how could this happen w/o a change on my end, I need to understand if there’s a versioning and locking system w/ base Docker images similar to semver as letting that float to latest is how this was introduced.

It looks like this is being reverted for the disruption FWIW

Wow, interesting case. To protect yourself from such cases, you would need to build everything from scratch :confused:

Anyway, thank you for updating the topic with such a detailed description!

Happy to help out and leave a good trail of breadcrumbs for the next dev :+1:

I am a Docker novice but I believe images can be tagged. The next things to explore are

  • How are tags utilized in Dockerfiles to ensure the base image consistency (i.e. cannot be updated w/o me taking an action or update)
  • How to determine if a base image update is “safe” to deploy. E.g. for updating gems/dependencies, I can run my test suite to get a really good idea. Do I need a local Docker build and run to ensure this?