docker-library / ruby

Docker Official Image packaging for Ruby
http://www.ruby-lang.org/
BSD 2-Clause "Simplified" License
590 stars 334 forks source link

`ruby-full` package installation fails on ruby:alpine-3.0.4 and ruby-3.0.5 #395

Closed vishnu-narayanan closed 1 year ago

vishnu-narayanan commented 1 year ago

Context

Automated docker builds started failing all of a sudden around three days back. Ref https://github.com/chatwoot/chatwoot/issues/6020

What has been tried?

Upgraded docker base image from alpine-3.0.4 to 3.0.5 but still fails with the same error.

on ruby:alpine-3.0.4

#12 [pre-builder  5/13] RUN apk add --no-cache musl ruby-full ruby-dev gcc make musl-dev openssl openssl-dev g++ linux-headers xz
#0 0.070 fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
#12 0.195 fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
#12 0.415 ERROR: unable to select packages:
#12 0.444   ruby-typeprof-0.21.2-r0:
#12 0.444     breaks: ruby-full-3.1.3-r0[ruby-typeprof>=0.21.3]
#12 ERROR: process "/bin/sh -c apk add --no-cache musl ruby-full ruby-dev gcc make musl-dev openssl openssl-dev g++ linux-headers xz" did not complete successfully: exit code: 2

on ruby:alpine-3.0.5

2022-12-06T08:04:16Z #4 [internal] load metadata for docker.io/library/ruby:3.0.5-alpine
2022-12-06T08:04:16Z #4 ...
2022-12-06T08:04:16Z
2022-12-06T08:04:16Z #10 [pre-builder 3/13] WORKDIR /app
2022-12-06T08:04:16Z #10 DONE 0.1s
2022-12-06T08:04:16Z
2022-12-06T08:04:16Z #11 [pre-builder 4/13] COPY Gemfile Gemfile.lock ./
2022-12-06T08:04:16Z #11 DONE 0.1s
2022-12-06T08:04:16Z
2022-12-06T08:04:16Z #12 [pre-builder 5/13] RUN apk add --no-cache musl ruby-full ruby-dev gcc make musl-dev openssl openssl-dev g++ linux-headers xz
2022-12-06T08:04:17Z #12 0.613 fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
2022-12-06T08:04:17Z #12 0.804 fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
2022-12-06T08:04:18Z #12 1.477 ERROR: unable to select packages:
2022-12-06T08:04:18Z #12 1.595 ruby-typeprof-0.21.2-r0:
2022-12-06T08:04:18Z #12 1.595 breaks: ruby-full-3.1.3-r0[ruby-typeprof>=0.21.3]
2022-12-06T08:04:18Z #12 ERROR: executor failed running [/bin/sh -c apk add --no-cache musl ruby-full ruby-dev gcc make musl-dev openssl openssl-dev g++ linux-headers xz]: exit code: 2
yosifkit commented 1 year ago

Any time you apk add an Alpine-provided (or apt-get install a Debian-provided) Ruby package in the images we maintain, you're installing a second (usually incompatible, sometimes in subtle ways; like python https://github.com/docker-library/python/issues/624) version of Ruby. You likely just want to skip those installs or just use FROM alpine:3.16 or alpine:3.17 instead.

As far as the apk add itself failing, it also fails in plain alpine:3.16 so it is not something in the image but a bug in Alpine's packages.

Update: I've filled an issue in Alpine: https://gitlab.alpinelinux.org/alpine/aports/-/issues/14425.

vishnu-narayanan commented 1 year ago

@yosifkit Thank you for the reply, and much much thanks for reporting it upstream.