metanorma / metanorma-docker

Docker container for running the Metanorma toolchain
https://www.metanorma.com
5 stars 3 forks source link

Impossible to install gems in container from Gemfile #77

Closed CAMOBAP closed 4 years ago

CAMOBAP commented 4 years ago

Intro

Recently I have fixed a couple of issues related to problems with installation gems from host Gemfile:

The fix by itself is in those lines: https://github.com/metanorma/mn-samples-mpfa/blob/master/.github/workflows/docker.yml#L41-L45

Long story short: in a docker container, only bundler add works for some reason, bundle install doesn't work

Expected result

Simple bundle install should work for host's Gemfile

Proposed solution

To be honest, IDK what causing of these problems, so I don't have a solution at this moment, I still feeling a lack of understanding the root of the issue, but this is something clearly related to bundler logic

Mode investigation details in attached tickets

CAMOBAP commented 4 years ago

@ronaldtse @abunashir please let me know if you have any idea about roots of the problem

ronaldtse commented 4 years ago

@ribose-jeffreylau was able to get around this issue with the combination of:

See this: https://gitlab.com/calconnect/tc-localization/csd-transcription-systems/-/blob/master/.gitlab-ci.yml

The make hack-update-metanorma target is this:

.PHONY: hack-update-metanorma
hack-update-metanorma:
    for u in "https://github.com/metanorma/metanorma-iso" \
        "https://github.com/metanorma/metanorma-standoc" \
        "https://github.com/metanorma/isodoc"; \
    do \
        reponame="$${u##*/}"; \
        git clone --depth 1 "$$u" && \
        pushd "$$reponame" && \
        gem build "$${reponame}" && \
        gem install *gem; \
        set -- *gem; \
        gemversion="$${1%.gem}" ; \
        gemversion="$${gemversion#$${reponame}-}" ; \
        echo reponame is $${reponame} ; \
        echo gemversion is "$${gemversion}" ; \
        sed -i.bkup -e 's/\('"$${reponame}"'\) ([0-9].*)/\1 ('"$${gemversion}"')/g' /setup/Gemfile.lock ; \
        popd ; \
    done
CAMOBAP commented 4 years ago

Thanks for the information, but bundle add ... in comparison with solution above looks much cleaner. I will develop this solution to support github gems

CAMOBAP commented 4 years ago

The script is ready https://github.com/metanorma/metanorma-build-scripts/blob/master/gemfile-to-bundle-add.sh