conda-incubator / conda-docker

Create minimal docker images from conda environments
BSD 3-Clause "New" or "Revised" License
60 stars 9 forks source link

Adding support for config field to docker layers #1

Closed costrouc closed 4 years ago

costrouc commented 4 years ago

Need a good way to test this.

I ran

from conda_docker.docker.base import Image
from conda_docker.registry.client import pull_image

image = pull_image('continuumio/miniconda3', 'latest')
image.remove_layer()
image.name = 'this-is-a-test'
image.add_layer_path('./')
image.add_layer_contents({
    'this/is/a/test1': b'this is test 1',
    'this/is/a/test2': b'this is test 2'
})
image.layers[0].config['Env'].append('FOO=BAR')
image.write_file('example-filter.tar')

This added the environment variable FOO. In general you should be able to update all docker settings now: LABEL, ENV, ENTRYPOINT, CMD, etc. Note that the first layer is the only layer looked at for docker settings... v2 changes this behavior by not storing the config in layers. But since this implements only the v1 spec I chose the v1 spec way of updating.

scopatz commented 4 years ago

Yeah we should add a minimal test suite I think.