nicbet / docker-phoenix

A dockerized Phoenix development and runtime environment.
GNU General Public License v3.0
277 stars 57 forks source link

specify htmlbeautifier version #27

Closed restlessronin closed 2 years ago

restlessronin commented 2 years ago

the latest version of htmlbeautifier is expecting a newer version of Ruby than is in the debian repo used Dockerfile.

i'm not familiar enough with Ruby to know what is the canonical repo to use, so I specified the version of htmlbeautifier.

Without this change, the Dockerfile isn't compiling on my M1.

Thanks @nicbet for enabling M1 images.

nicbet commented 2 years ago

@restlessronin have you by chance tried to compile with docker build --no-cache? Spent all day yesterday building the containers on a new M1 machine and had no problems with the repo as it is. I'd rather not pin a specific version in the Dockerfile if that can be avoided.

restlessronin commented 2 years ago

Yes I tried with --no-cache and I still had the same issue. However I did check the images tags in Docker and it turns out that I have nicbet/phoenix:1.6.2 which was created a month ago. So I pulled latest, which was created yesterday. Changing the FROM tag in the .devcontainer/Dockerfile to latest still results in the same error

#5 5.170 ERROR:  Error installing htmlbeautifier:
#5 5.170        The last version of htmlbeautifier (>= 0) to support your Ruby & RubyGems was 1.3.1. Try installing it with `gem install htmlbeautifier -v 1.3.1`
#5 5.170        htmlbeautifier requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

I'm puzzled about the seeming non-deterministic results between your Mac and mine.

Perhaps the version could be pinned by an ARG, the same way the version is pinned for Phoenix / Node? The actual objection is to hard-coding the value, is it not? In the long run, a Docker image should have deterministic (predictable) versions of all important components (not sure that applies to html-beautifier :-).

nicbet commented 2 years ago

Can you post a log of your make docker-image run of the latest master branch of this repo?

For reference, here is what it looks like on my M1 machine:

make docker-image                                                                                                                                           100% (...)  10:19:11
Building image with tag nicbet/phoenix:1.6.2
[+] Building 27.1s (17/17) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                            0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                                                                                 0.0s
 => [internal] load metadata for docker.io/library/elixir:1.12.3                                                                                                                                                                                0.6s
 => [auth] library/elixir:pull token for registry-1.docker.io                                                                                                                                                                                   0.0s
 => CACHED [ 1/12] FROM docker.io/library/elixir:1.12.3@sha256:3eb0be04a7d36a1595dae296b92c48cfd7a8db88e5999e4b78dbe69584b6b37a                                                                                                                 0.0s
 => [ 2/12] RUN apt-get update && apt-get upgrade -y                                                                                                                                                                                            2.2s
 => [ 3/12] RUN apt-get install -y apt-utils                                                                                                                                                                                                    1.2s
 => [ 4/12] RUN apt-get install -y build-essential                                                                                                                                                                                              0.8s
 => [ 5/12] RUN apt-get install -y inotify-tools                                                                                                                                                                                                0.8s
 => [ 6/12] RUN curl -sL https://deb.nodesource.com/setup_16.x | bash                                                                                                                                                                          13.7s
 => [ 7/12] RUN apt-get install -y nodejs                                                                                                                                                                                                       3.9s
 => [ 8/12] RUN mix local.hex --force                                                                                                                                                                                                           0.9s
 => [ 9/12] RUN mix archive.install --force hex phx_new #{PHOENIX_VERSION}                                                                                                                                                                      1.6s
 => [10/12] RUN mix local.rebar --force                                                                                                                                                                                                         0.7s
 => [11/12] RUN mkdir -p /app                                                                                                                                                                                                                   0.1s
 => [12/12] WORKDIR /app                                                                                                                                                                                                                        0.0s
 => exporting to image                                                                                                                                                                                                                          0.3s
 => => exporting layers                                                                                                                                                                                                                         0.3s
 => => writing image sha256:d39300e209f863b1c4995866f9d443dbedaae56d35713caf73189162c2903d0d                                                                                                                                                    0.0s
 => => naming to docker.io/nicbet/phoenix:1.6.2
nicbet commented 2 years ago

Nevermind, I just figured that we are talking about the Dockerfile in the .devcontainer subdirectory, not the main Dockerfile. You are right, I get the same error when trying to build the VSCode devcontainer.

Investigating...

nicbet commented 2 years ago

Yes, so the Elixir docker image is based on the erlang:24 image, which in turn is based on buildpacks:buster, which is ultimately based on debian:buster and they include Ruby up to 2.5.0.

A recent change to htmlbeautifier (https://github.com/threedaymonk/htmlbeautifier/commit/ab234f0bde2c47244972eb3c37b46923b6d964dc) set the minimum required version to Ruby > 2.6.0 for the latest version (1.4.0) of the gem.

I'm okay to pin htmlbeautifier gem version in the VSCode devcontainer for now, until upstream elixir and erlang move on to Debian Bullseye and a newer Ruby version.

restlessronin commented 2 years ago

Great. Thanks.