calm-dsl icon indicating copy to clipboard operation
calm-dsl copied to clipboard

Suggestion: Add `make stage` for preparing ready-to-use Docker container

Open digitalformula opened this issue 4 years ago • 0 comments

Consider implementing something like make stage where Dockerfile contains something like the snippet below.

RUN mkdir -p /root/.calm/.local
COPY config.ini.example /root/.calm/config.ini
COPY init.ini.example /root/.calm/init.ini

The idea is to avoid the explicit need to run calm init dsl every time the container starts. Labs, for example, could take great advantage of this, as could pre-staging a test or certification environment where time is money (so to speak). If we have the PC IP and credentials, the files referenced above could be pre-populated, or the planned feature for reading from ENV could be utilised.

Updating Dockerfile could be achieved with:

sed -i "39i RUN mkdir -p /root/.calm/.local" Dockerfile
sed -i "40i COPY config.ini.example /root/.calm/config.ini" Dockerfile
sed -i "41i COPY init.ini.example /root/.calm/init.ini" Dockerfile
sed "42i RUN calm update cache" Dockerfile

That also makes sure ~/.calm/dsl.db is created and cache updated before the container is used for the first time.

Have tested all this and it works fine.

digitalformula avatar Aug 13 '20 01:08 digitalformula