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

Issue with epub generation #9

Closed
lmammino opened this issue Apr 21, 2024 · 8 comments
Closed

Issue with epub generation #9

lmammino opened this issue Apr 21, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@lmammino
Copy link
Contributor

This might be a docker image versioning issue, since by default the template is configured to get the latest version of asciidoctor/docker-aciidoctor, but when I run:

./create-book-epub.sh

I get the following error:

<internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:159:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:159:in `rescue in require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:39:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/extension.rb:31:in `rescue in <top (required)>'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/extension.rb:4:in `<top (required)>'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub/meta.rb:2:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub.rb:8:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/lib/asciidoctor-epub3.rb:5:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/bin/asciidoctor-epub3:5:in `<top (required)>'
	from /usr/bin/asciidoctor-epub3:25:in `load'
	from /usr/bin/asciidoctor-epub3:25:in `<main>'
<internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/extension.rb:31:in `rescue in <top (required)>'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/extension.rb:4:in `<top (required)>'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub/meta.rb:2:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub.rb:8:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/lib/asciidoctor-epub3.rb:5:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/bin/asciidoctor-epub3:5:in `<top (required)>'
	from /usr/bin/asciidoctor-epub3:25:in `load'
	from /usr/bin/asciidoctor-epub3:25:in `<main>'
/usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative': Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/3.2/nokogiri.so) - /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/3.2/nokogiri.so (LoadError)
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri/extension.rb:7:in `<top (required)>'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri.rb:8:in `require_relative'
	from /usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.3-aarch64-linux/lib/nokogiri.rb:8:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub/meta.rb:2:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/gepub-1.0.15/lib/gepub.rb:8:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/lib/asciidoctor-epub3.rb:5:in `<top (required)>'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/lib/ruby/gems/3.2.0/gems/asciidoctor-epub3-2.1.0/bin/asciidoctor-epub3:5:in `<top (required)>'
	from /usr/bin/asciidoctor-epub3:25:in `load'
	from /usr/bin/asciidoctor-epub3:25:in `<main>'

Same issue if I run:

./interactive-asciidoctor-shell.sh

And then from within the container:

asciidoctor-epub index.adoc

Docker image details

docker inspect asciidoctor/docker-asciidoctor
[
    {
        "Id": "sha256:a53a0d18ef385f9876cb81f2ac4c81901542f97608e2e3ff25586a92ef94a346",
        "RepoTags": [
            "asciidoctor/docker-asciidoctor:latest"
        ],
        "RepoDigests": [
            "asciidoctor/docker-asciidoctor@sha256:24d89da5d1c89f1c1e63591f80365c0c199d4098e944a06759821e81b16d18db"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2024-04-08T06:42:15.664656927Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "ASCIIDOCTOR_VERSION=2.0.22",
                "ASCIIDOCTOR_PDF_VERSION=2.3.15",
                "ASCIIDOCTOR_CONFLUENCE_VERSION=0.0.2",
                "ASCIIDOCTOR_DIAGRAM_VERSION=2.3.0",
                "ASCIIDOCTOR_EPUB3_VERSION=2.1.0",
                "ASCIIDOCTOR_FB2_VERSION=0.7.0",
                "ASCIIDOCTOR_MATHEMATICAL_VERSION=0.3.5",
                "ASCIIDOCTOR_REVEALJS_VERSION=5.1.0",
                "KRAMDOWN_ASCIIDOC_VERSION=2.1.0",
                "ASCIIDOCTOR_BIBTEX_VERSION=0.9.0",
                "ASCIIDOCTOR_KROKI_VERSION=0.10.0",
                "ASCIIDOCTOR_REDUCER_VERSION=1.0.2",
                "PIPX_HOME=/opt/pipx",
                "PIPX_BIN_DIR=/usr/local/bin",
                "PIPX_MAN_DIR=/usr/local/share/man"
            ],
            "Cmd": [
                "/bin/bash"
            ],
            "ArgsEscaped": true,
            "Image": "",
            "Volumes": {
                "/documents": {}
            },
            "WorkingDir": "/documents",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "maintainers": "Guillaume Scheibel <[email protected]>, Damien DUPORTAL <[email protected]>",
                "org.opencontainers.image.source": "https://github.com/asciidoctor/docker-asciidoctor"
            }
        },
        "Architecture": "arm64",
        "Os": "linux",
        "Size": 798281180,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/e11d28271569d2e7d3462636b653228fc0b0157578a117698ee7e69b2a262e72/diff:/var/lib/docker/overlay2/3ecbe3fdc32ffc200870922534f0549b1017387a1317a91d58ffdc8067d3917a/diff:/var/lib/docker/overlay2/0adecbc305ddb19f4ee3b5395f2204ca27785e7ccf5c121f2d0c1d04c226f748/diff:/var/lib/docker/overlay2/0c26cf765477e3a71da3c19fc3306e67a2aa38476c43ce31c132b4cb61b69944/diff:/var/lib/docker/overlay2/0931afa8f8772e63ec081856bdfd43b445abc32db75e41f0b5a4fa18181d1dda/diff:/var/lib/docker/overlay2/70cbe61eadbd4821b5449fef2e85b3485fce9f22d8e0de65c0d92e30f3952733/diff:/var/lib/docker/overlay2/0c1c3900079856d8d273e286b2f96a23c12ad04e0671519dd35e746e07c08e51/diff:/var/lib/docker/overlay2/3b98dc28619c9438dc1bc771173938bd7e0802e95cbbe1acfa3f29c89244b6bf/diff:/var/lib/docker/overlay2/0ce08bb70d23cbecd263e149c624095fec0b95a88dfe4f66f0442fa6277aed2b/diff",
                "MergedDir": "/var/lib/docker/overlay2/b075279b18f4b51137c471c4669c76d86b6678dfb5b948397092444b4e591523/merged",
                "UpperDir": "/var/lib/docker/overlay2/b075279b18f4b51137c471c4669c76d86b6678dfb5b948397092444b4e591523/diff",
                "WorkDir": "/var/lib/docker/overlay2/b075279b18f4b51137c471c4669c76d86b6678dfb5b948397092444b4e591523/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:b09314aec293bcd9a8ee5e643539437b3846f9e5e55f79e282e5f67e3026de5e",
                "sha256:a3573faa34ce68715a088fa20e6499ae3cb621aceb5a1294d970cd68d7ba4395",
                "sha256:017b0351b5dbb71fdca1931f01be53085626769658742ba23c3d0acd13e7139a",
                "sha256:be502f3640bc1bd7df5fe98bee50f12780c174c7615354cae380b9d7e16aeb3d",
                "sha256:9061acaf90c4761fa38f8462b2c4671fa7e94569af76f460e0fc2b1a429c267c",
                "sha256:a8fe910feef0674b4a8cb3728a746451f21bd0bf96f7c17b7b936f64b36181eb",
                "sha256:82abba69eeaa0d609632f693a2b537125ed03e95532df540ba88eb9b00abca97",
                "sha256:dbaf3de624d0ba84efb90d338da37ccdf5eb0ae5e49f461b7c31d073c62dd257",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
                "sha256:4ccbff251893db480da79e5f15de3330ed7dfa9f68845354d0f7822aba5343ab"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
@lirantal lirantal self-assigned this Apr 25, 2024
@lirantal lirantal added the bug Something isn't working label Apr 25, 2024
@lirantal
Copy link
Owner

@lmammino still reproducing?

My asciidoc container info is as follows:

"Id": "sha256:89cf01db4a49646512b374747e1ab42ce68b3200d6c9475eba8ad40c785f77ac",
        "RepoTags": [
            "asciidoctor/docker-asciidoctor:latest"
        ],
"RepoDigests": [
            "asciidoctor/docker-asciidoctor@sha256:c2bcc82f9e3210d921c7a8038b28f9d3b140dce69028f0b25488c5dcb6f46ae5"
        ],
"Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2024-03-12T18:53:38.733015519Z",

Try to use that specific sha so we compare the same container images. Maybe it's something else entirely too.

@lmammino
Copy link
Contributor Author

I tried to run the epub script with the specific SHA you have but it seems it's not able to find that image anymore (assuming my command is correct):

BOOK_SOURCE_DIR=book BOOK_BUILD_DIR=build docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor@sha256:89cf01db4a49646512b374747e1ab42ce68b3200d6c9475eba8ad40c785f77ac asciidoctor-epub3 -D $BOOK_BUILD_DIR $BOOK_SOURCE_DIR/index.adoc

Output:

Unable to find image 'asciidoctor/docker-asciidoctor@sha256:89cf01db4a49646512b374747e1ab42ce68b3200d6c9475eba8ad40c785f77ac' locally
docker: Error response from daemon: manifest for asciidoctor/docker-asciidoctor@sha256:89cf01db4a49646512b374747e1ab42ce68b3200d6c9475eba8ad40c785f77ac not found: manifest unknown: manifest unknown.
See 'docker run --help'.

@lmammino
Copy link
Contributor Author

FYI, at the moment I solved this by having a local Ruby 3.3.0 install with the following Gemfile:

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

ruby file: ".ruby-version"

gem 'asciidoctor'
gem 'asciidoctor-epub3'
gem 'asciidoctor-pdf'
gem 'nokogiri'

And then running:

bundle exec asciidoctor-epub3 --out-file build/book.epub book/index.adoc

I don't know if you want to go down the path of maintaining your own docker image, but it shouldn't be to hard to create one with the necessary ruby packages...

@lirantal
Copy link
Owner

lirantal commented May 3, 2024

Ugh, oooff yes you're right I can reproduce that when I clone this repo again. and yes, I also can't find that SHA too.

It looks indeed that the image setup changed and maybe they removed some of the deps which explains why you need to install them manually.

I'll see about maintaining a fork or maybe there's another tag that includes them.

@lirantal
Copy link
Owner

lirantal commented May 3, 2024

Quickly searched the asciidoctor repo and found this which I think is what we're stumbling into:
image

@lirantal
Copy link
Owner

lirantal commented May 3, 2024

and an open issue on this: asciidoctor/docker-asciidoctor#430 ;-)

@lmammino
Copy link
Contributor Author

lmammino commented May 5, 2024

I am not sure how they are thinking to fix an issue by removing the dependency entirely, but good catch! :D

And thanks for opening an issue on the official repo, probably better than going off and trying to start a fork!

@lirantal
Copy link
Owner

FYI: I pushed an update to pin the asciidoctor Docker image to version 1.63 from April 2024 that successfully generates the epub due to dependencies working just fine in that version.

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

No branches or pull requests

2 participants