Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax targetDir requirements #1244

Merged
merged 3 commits into from
Aug 10, 2019
Merged

Relax targetDir requirements #1244

merged 3 commits into from
Aug 10, 2019

Conversation

tobiasstadler
Copy link
Contributor

It should be possible that targetDir starts with an environment variable (e.g. to copy a war to the deployment dir of an app server)

…ble (e.g. to copy a war to the deployment dir of an app server)

Signed-off-by: Tobias Stadler <ts.stadler@gmx.de>
@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #1244 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #1244      +/-   ##
============================================
+ Coverage      53.9%   53.91%   +<.01%     
- Complexity     1637     1638       +1     
============================================
  Files           155      155              
  Lines          8249     8250       +1     
  Branches       1263     1263              
============================================
+ Hits           4447     4448       +1     
  Misses         3359     3359              
  Partials        443      443
Impacted Files Coverage Δ Complexity Δ
...bric8/maven/docker/assembly/DockerFileBuilder.java 90.78% <100%> (+0.04%) 82 <0> (+1) ⬆️

1 similar comment
@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #1244 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #1244      +/-   ##
============================================
+ Coverage      53.9%   53.91%   +<.01%     
- Complexity     1637     1638       +1     
============================================
  Files           155      155              
  Lines          8249     8250       +1     
  Branches       1263     1263              
============================================
+ Hits           4447     4448       +1     
  Misses         3359     3359              
  Partials        443      443
Impacted Files Coverage Δ Complexity Δ
...bric8/maven/docker/assembly/DockerFileBuilder.java 90.78% <100%> (+0.04%) 82 <0> (+1) ⬆️

@rohanKanojia rohanKanojia requested a review from rhuss July 15, 2019 05:27
@rhuss
Copy link
Collaborator

rhuss commented Jul 22, 2019

It should be possible that targetDir starts with an environment variable (e.g. to copy a war to the deployment dir of an app server)

Could you please elaborate on your use case ? IIUR this PR should allow for the target directoruy for COPY operation an environment variable so that you get entries in your Dockerfile like

COPY target/myapp.war ${TOMCAT_HOME}/webapps/

Who would set this environment variable ${TOMCAT_HOME} which is evaluated during Docker build time, not when the container is running ?

@tobiasstadler
Copy link
Contributor Author

In my case I do have a per built docker image with ENV WILDFLY_DEPLOYMENT_DIR=/srv/wildfly/standalone/deployments/ and I want to copy the war built by maven to that dir.

Right now I am using /${WILDFLY_DEPLOYMENT_DIR} as the target dir, but I would be nicer if I could remove the / at the beginning.

@rhuss
Copy link
Collaborator

rhuss commented Jul 23, 2019

@tobiasstadler sorry, I still did not fully get it ;-) Would you mind to share you concrete plugin configuration ? Thanks !

@tobiasstadler
Copy link
Contributor Author

Here is a simplified version of what I want to achieve:

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.tobiasstadler</groupId>
    <artifactId>docker-maven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <properties>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.30.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <images>
                        <image>
                            <name>tobiasstadler/docker-maven</name>
                            <build>
                                <from>airhacks/wildfly</from>
                                <assembly>
                                    <descriptorRef>artifact</descriptorRef>
                                    <targetDir>${DEPLOYMENT_DIR}</targetDir>
                                </assembly>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

DEPLOYMENT_DIR is "exposed" by the airhacks/wildfly image.

@rhuss
Copy link
Collaborator

rhuss commented Aug 10, 2019

I see. Using a variable like this in the config might be a bit dangerous because Maven would replace this when this is set in a property. Only when it's unset it's copied over literally.

Copy link
Collaborator

@rhuss rhuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, let's get this in.

@rhuss rhuss merged commit f457ea9 into fabric8io:master Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants