fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 642 forks source link

Support to copy resources to another path #465

Closed cmoulliard closed 8 years ago

cmoulliard commented 8 years ago

Currently, all the resources generated under local directory target/maven are copied to /path within the Docker image according to the basedir property

                <version>${docker.maven.plugin.version}</version>
                <configuration>
                    <images>
                        <image>
                            <name>${docker.image}</name>
                            <build>
                                <from>${docker.from}</from>
                                <assembly>
                                    <basedir>/deployments</basedir>
                                    <descriptor>${project.basedir}/src/main/resources/assemblies/apiman-gateway-app.xml</descriptor>

This config works very well excepted that all the content defined under the folder maven will be copied to /deployments as defined within the Dockerfile generated

COPY maven /deployments/

If we would like to copy resources to a specific path, this is not possible. Si, I would like to suggest that the docker command COPY is also supported

<build>
     <copy>maven/secret /secret</copy>
</build>
rhuss commented 8 years ago

You should use a another baseDir than /deployments (which is the default). That goes directly below <build>.

@cmoulliard could I have a look on the full project so that I can reproduce it ? (and maybe fix the setup)

rhuss commented 8 years ago

If you need more flexibility for creating images, I recommend to use the dockerfile mode, where an external Dockerfile is evaluated. <copy> wont be added to the plugin-config mode since this overlaps with the assembly (and there's nothing a <copy> could do what an assembly can't)

cmoulliard commented 8 years ago

Here is the link - https://github.com/cmoulliard/fabric8-ipaas/blob/56d90415bfbcc8bc79b7c8cec3cc2e62629fb286/apiman-gateway/pom.xml#L124

rhuss commented 8 years ago

Solution that worked: