Reputation: 787
Is it possible to read a configuration file e.g. json or yml file inside docker-compose and then parse the file and install the libraries listed in that file. For example
modules.json
{
"base": {
},
"myproject": {
"apcu": "php-apcu",
"memcache": "php-memcache",
"xmlrpc": "php-xmlrpc",
"mysql": "php-mysql",
"gd": "php-gd",
"soap": "php-soap",
"zip": "php-zip"
}
}
And then have this referenced in the .env file like MODULE=myproject
Inside the DockerFile I would then like to do
RUN apt-get -y --no-install-recommends install php-apcu
etc?
Upvotes: 0
Views: 427
Reputation: 501
In Dockerfile you should:
Dockerfile example:
RUN apt-get install -y jq
COPY modules.json .
RUN cat modules.json | jq .myproject[] | sed -e 's/"//g' -e "s/'//g" | xargs apt-get -y --no-install-recommends install
Upvotes: 1