foliant-docs / docker

Docker images for Foliant
https://github.com/foliant-docs/docker/pkgs/container/foliant%2Ffoliant
MIT License
7 stars 4 forks source link

docker hub image needs a rebuild #1

Closed BrianMowrey closed 3 years ago

BrianMowrey commented 4 years ago

Issue: building now fails with

Making site... Build failed: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/foliant/backends/slate.py", line 253, in make
    r = run(
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'bundle exec middleman build --clean' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/foliant/backends/slate.py", line 262, in make
    raise RuntimeError(e.output.decode('utf8', errors='ignore'))
RuntimeError: /var/lib/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize': Could not find minitest-5.14.2 in any of the sources (Bundler::GemNotFound)
    from /var/lib/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `map!'
    from /var/lib/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `materialize'
    from No result returned by backend

resolution: The latest slate version (2.8.0) bumped middleman to 4.3.11 which requires a few more gems, No code changes, but foliant/foliant needs a rebuild to install all the new gems.

temporary fix for projects, change your Dockerfile to this

FROM foliant/foliant:full
RUN mkdir -p /usr/src/app/dependency_files/slate/ \
    && cd /usr/src/app/dependency_files/slate/ \
    && wget -O ./Gemfile https://raw.githubusercontent.com/slatedocs/slate/main/Gemfile \
    && wget -O ./Gemfile.lock https://raw.githubusercontent.com/slatedocs/slate/main/Gemfile.lock \
    && apt install -y zlib1g-dev ruby-full \
    && gem install bundler \
    && bundle install

and run

docker-compose build

or rebuild your own foliant:foliant from scratch

anorm commented 3 years ago

This is also the case with the current foliant/foliant:full image on docker hub:

Parsing config... Done
Applying preprocessor plantuml... Done
Applying preprocessor flatten... Done
Applying preprocessor _unescape... Done
Making site... Build failed: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/foliant/backends/slate.py", line 253, in make
    r = run(
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'bundle exec middleman build --clean' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/foliant/backends/slate.py", line 262, in make
    raise RuntimeError(e.output.decode('utf8', errors='ignore'))
RuntimeError: `/` is not writable.
Bundler will use `/tmp/bundler20210201-20-10q3esc20' as your home directory temporarily.
/var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/spec_set.rb:87:in `block in materialize': Could not find rouge-3.26.0 in any of the sources (Bundler::GemNotFound)
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/spec_set.rb:81:in `map!'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/spec_set.rb:81:in `materialize'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/definition.rb:175:in `specs'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/definition.rb:245:in `specs_for'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/definition.rb:227:in `requested_specs'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/runtime.rb:91:in `block in definition_method'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/runtime.rb:20:in `setup'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler.rb:148:in `setup'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/setup.rb:20:in `block in <top (required)>'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/ui/shell.rb:136:in `with_level'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/ui/shell.rb:88:in `silence'
        from /var/lib/gems/2.7.0/gems/bundler-2.2.6/lib/bundler/setup.rb:20:in `<top (required)>'
        from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
        from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'

No result returned by backend
Vanderhoof commented 3 years ago

@anorm sorry for late reply! We're taking gemfile from slate repo for foliant:full, so all gems should be installed. I just checked, foliant make site -w slate works fine for me. Do you still have this issue?

BrianMowrey commented 3 years ago

The issue is the docker image is built with an older Gemfile to build the dependencies and then a newer slate is checked out when making the docs which causes the dependency issue Steps to reproduce:

git clone https://github.com/foliant-docs/foliant_project_template.git
cd foliant_project_template
docker-compose build
docker-compose run --rm foliant make site -w slate

Even if someone just builds and pushes a new version of foliant/foliant:full without any changes it should start working as it will pull the newer Gemfile.

Vanderhoof commented 3 years ago

@BrianMowrey Yes, that's a limitation, but you can always add steps for updating the dependencies from fresh gemfile to your own Dockerfile, e.g.

FROM foliant/foliant:full

RUN mkdir -p /usr/src/app/dependency_files/slate/ \
    && cd /usr/src/app/dependency_files/slate/ \
    && wget -O ./Gemfile https://raw.githubusercontent.com/slatedocs/slate/main/Gemfile \
    && wget -O ./Gemfile.lock https://raw.githubusercontent.com/slatedocs/slate/main/Gemfile.lock \
    && bundle install

We rebuild the image quite regularly, each time with fresh Gemfile. We also have personal pipelines with Slate projects, so if Slate issues new version and it breaks the image, we should notice, but of course we will be grateful for a friendly nudge if you notice it first :}

BrianMowrey commented 3 years ago

yes, that's all this is, a friendly nudge saying the docker hub image isn't working. Maybe something is broken on your automatic build/push as it has been ~4 months and the docker image is still broken. We've been using the workaround I mentioned since and it's been fine but frustrating for new projects following the documentation to get started.

Vanderhoof commented 3 years ago

@BrianMowrey wait, you STILL have this problem? Everything works fine when I try your example:

git clone https://github.com/foliant-docs/foliant_project_template.git
cd foliant_project_template
docker-compose build
docker-compose run --rm foliant make site -w slate
Cloning into 'foliant_project_template'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 11 (delta 1), reused 11 (delta 1), pack-reused 0
Unpacking objects: 100% (11/11), done.
Building foliant
Step 1/1 : FROM foliant/foliant:full
 ---> f320ab0b4ffe

Successfully built f320ab0b4ffe
Successfully tagged foliant_project_template_foliant:latest
Creating foliant_project_template_foliant_run ... done
Parsing config... Done
Applying preprocessor flatten... Done
Applying preprocessor _unescape... Done
Making site... 
Project built successfully.

Done
────────────────────
Result: New_Foliant_Project-2021-03-08.slate/

Have you pulled and built the latest image?

BrianMowrey commented 3 years ago

hmm, I am pretty sure I had last time, but I cleaned my docker system and my test case works now.

Thanks!