ottomatica/slim

ability to pass environments variables to the docker image

unixfox opened this issue · 1 comments

I would like to pass environment variables to the docker image, would this be a possible feature?
On my fork I made this change, is it enough for you as a possible pull request: https://github.com/unixfox/slim/commit/8579013966fa487e6c0accca1c16b877783ecdba to fulfill this feature request?

Thanks for the suggestion @unixfox, this feature would be pretty useful. The commit looks good to me!

After this change, we can add a simple example like this in readme to explain this feature:

add variables in info.yml:

description: My alpine image
base_args:
  PKGS: tmux
  FOO: "${TOKEN}" 

and use it in the Dockerfile:

...
FROM alpine:3.9.4 AS install
USER root
# the public key that is authorized to connect to this instance.
ARG SSHPUBKEY
# optional packages
ARG PKGS
ARG FOO
...
RUN echo $FOO > /token
...