metaparticle-io / package

Metaparticle/Package: Language Fluent Containerization and Deployment in Java, .NET and Javascript (and more coming soon)
https://metaparticle.io
MIT License
493 stars 55 forks source link

Add python additionalFiles option #125

Closed wagoodman closed 6 years ago

wagoodman commented 6 years ago

Here's a rough cut at issue #2... once there is general agreement on this approach, I'll fill in some tests and start filling this out for other languages.

This example isn't working yet since the metaparticle lib within the container is unaware of the new functionality (specifically, the PackageFile is seen as a bad import)... otherwise this example appears to be working.

I decided to go with an class over a simple dictionary of { dest: src} because now it is

However, I think it would be a good time to discuss having mixed objects in the Containerize definition or to instead always use dict/list primitives when possible... e.g. something like this instead:

@Containerize(
    package={
        'name': 'file-example',
        'repository': 'docker.io/brendanburns',
        'publish': False,
        'additionalFiles': {
            './data.json': '/some/container/path',
            './get_data.sh': '/another/container/path',
        }
    }
)
brendandburns commented 6 years ago

Needs a rebase since I merged your other PR...

wagoodman commented 6 years ago

@brendandburns : rebased. Do you have any opinions around providing a list of files via a list of rich objects (implemented in the PR) or by instead a simple dictionary (example given in the description)?

brendandburns commented 6 years ago

I think that nested is great actually, it looks more expressive to me.

Once this is fully ready and working, I'd be ok to merge.

Thanks! --brendan

wagoodman commented 6 years ago

Just to double check, @brendandburns, by "nested" do you mean the alternative example above:

@Containerize(
    package={
        'name': 'file-example',
        'repository': 'docker.io/brendanburns',
        'publish': False,
        'additionalFiles': {
            './data.json': '/some/container/path',
            './get_data.sh': '/another/container/path',
        }
    }
)

or do you mean what's implemented in this PR? e.g.:

@Containerize(
    package={
        'name': 'file-example',
        'repository': 'docker.io/brendanburns',
        'publish': False,
        'additionalFiles': [
            PackageFile(src='./data.json', dest= '/some/container/path', mode='0400'),
            PackageFile(src='./get_data.sh', dest='/another/container/path'),
        ]
    }
)