Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Should dockerfile be child of the contextDirectory? #336

Closed
jcchavezs opened this issue Jan 2, 2020 · 7 comments
Closed

Should dockerfile be child of the contextDirectory? #336

jcchavezs opened this issue Jan 2, 2020 · 7 comments
Labels

Comments

@jcchavezs
Copy link

jcchavezs commented Jan 2, 2020

FEATURE REQUEST:

Description

Relax the condition where dockerfile should be a child element of contextDirectory:

if (!dockerfile.startsWith(contextDirectory)) {
. This is not an ideal restriction as for example docker-compose allows to have something like:

  myapp:
    build:
      context: ./path
      dockerfile: ../Dockerfile

How to reproduce

<plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>dockerfile-maven-plugin</artifactId>
                    <version>1.4.13</version>
                    <executions>
                        <execution>
                            <id>default-cli</id>
                            <goals>
                                <goal>build</goal>
                                <goal>push</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <repository>${dockerfile.registryUrl}/library/${project.artifactId}</repository>
                        <tag>${git.commit.id}</tag>
                        <contextDirectory>${project.parent.basedir}/${project.name}</contextDirectory>
                        <dockerfile>${project.parent.basedir}/Dockerfile</dockerfile>
                        <buildArgs>
                            <APP_NAME>${project.name}</APP_NAME>
                        </buildArgs>
                        <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
                        <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
                        <noCache>true</noCache>
                    </configuration>
                </plugin>

What do you expect

Accept any location for dockerfile

What happened instead

Shows an error if it is not a child file

I can come up with a PR for this.

@Tychom
Copy link

Tychom commented Jan 15, 2020

Not only is this possible in docker-compose but also with docker build:

docker build -f ../Dockerfile ./path

So this restriction seems unnecessary.

@cr-kobyisrael
Copy link

I also think this should be supported. It's already solved in docker repo and needs to be added here as well.
see: docker/cli#886

@stale
Copy link

stale bot commented Mar 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 26, 2020
@jcchavezs
Copy link
Author

Interesting how this issue is marked as stale even when no maintainers have given feedback or had a look at it.

@stale stale bot removed the stale label Mar 26, 2020
@stale
Copy link

stale bot commented May 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 25, 2020
@stale stale bot closed this as completed Jun 2, 2020
@jcchavezs
Copy link
Author

Does it make sense to accept issues on this repo if a bot is going to close them with no involvement from maintainers?

@stodge
Copy link

stodge commented Sep 18, 2020

Being able to specify a path to a dockerfile makes sense to me: <dockerfile>${project.parent.basedir}/Dockerfile</dockerfile>. The assumption that the Dockerfile is in the context is too rigid.

But after 9 months I won't hold my breath. I'll have to look for another Maven plugin. Any suggestions?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants