Skip to content

Dockerfile needs some love #267

@LanceMcCarthy

Description

@LanceMcCarthy

If you try to deploy the docs-seed (with a target documentation) using Docker, there are problems out-of-the-box.

For example, one Gem bundler says it uses v1, while the Gemfile.lock requires v2 or later. I was able to fix this by installing 2.0 or later in the Dockerfile's commands and setting the environment variable.

RUN gem update --system --quiet && gem install bundler -v '~> 2.1'
  
ENV BUNDLER_VERSION 2.1

Another issue was around the Docker build context failing to satisfy some apt commands. I've haven't gotten to the bottom of which packages are to blame. I just put the --force-yes sledgehammer on all of them to workaround it for now.

Here is the combination that was successful for me locally from WSL (WSL2 Ubuntu). I don't know if it will be useful for the wider scope of folks/environments, but I thought I'd share anyways.

Dockerfile

# LINE 17 

ENV APP_ROOT /app_root

# WORKAROUND 1 - Install the bundler v2+
RUN \
  gem update --system --quiet && \
  gem install bundler -v '~> 2.1'
  
ENV BUNDLER_VERSION 2.1

# By adding Gemfiles and invoke bundle install before copy all files we are using container cache for gems.
ADD Gemfile ${APP_ROOT}/
ADD Gemfile.lock ${APP_ROOT}/

WORKDIR ${APP_ROOT}
RUN bundle check || bundle install

# Continue ...

Gemfile.lock

GEM
...

PLATFORMS
...

DEPENDENCIES
...

# WORKAROUND 2 - Downgrade this
BUNDLED WITH
   1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions