[JIRA] (JENKINS-41668) No way to specify directory for dockerfile

3 views
Skip to first unread message

leandro.lucarella@sociomantic.com (JIRA)

unread,
Feb 2, 2017, 12:03:04 PM2/2/17
to jenkinsc...@googlegroups.com
Leandro Lucarella created an issue
 
Jenkins / Improvement JENKINS-41668
No way to specify directory for dockerfile
Issue Type: Improvement Improvement
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Feb/02 5:02 PM
Priority: Minor Minor
Reporter: Leandro Lucarella

It looks like there is no way to specify a directory to build an image using the "dockerfile" option. It only supports "filename", which is analogous to "-f" for the "docker build" command-line, but "docker build" takes as a required argument the DIRECTORY. This is necessary if you don't want the docker daemon to copy the whole repository when making the image, and you want instead to export just a small subset of files. Maybe adding something like "build_args" could be more flexible.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

leandro.lucarella@sociomantic.com (JIRA)

unread,
Feb 2, 2017, 12:24:04 PM2/2/17
to jenkinsc...@googlegroups.com
Leandro Lucarella commented on Improvement JENKINS-41668
 
Re: No way to specify directory for dockerfile

For example, for a very simple project with a Dockerfile in docker/:
docker build -t test -f docker/Dockerfile . -> Sending build context to Docker daemon 9.861 MB
docker build -t test -f docker/Dockerfile docker -> Sending build context to Docker daemon 2.048 kB

Sending ~10MB vs sending 2KB.

I really hope this issue gets addressed soon because it blocking us from using declarative pipelines as all our projects use this trick to avoid so much copying to the docker daemon...

jdumay@cloudbees.com (JIRA)

unread,
Feb 6, 2017, 1:51:02 AM2/6/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Feb 6, 2017, 3:50:03 AM2/6/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Improvement JENKINS-41668
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Feb 6, 2017, 3:50:05 AM2/6/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Feb 6, 2017, 3:50:07 AM2/6/17
to jenkinsc...@googlegroups.com

leandro.lucarella@sociomantic.com (JIRA)

unread,
Feb 6, 2017, 7:04:02 AM2/6/17
to jenkinsc...@googlegroups.com
Leandro Lucarella commented on Improvement JENKINS-41668
 
Re: No way to specify directory for dockerfile

Thanks a lot for the quick response. I found a workaround though, I can use a `.dockerignore` file with:

*
!docker/

That would make the image building process to ignore everything outside the docker directory, which is what I wanted.

Nevertheless, I think is a good feature to have in pipeline models, specially a `build_args` option since it makes it as flexible and future-proof as it can get.

scm_issue_link@java.net (JIRA)

unread,
Feb 15, 2017, 9:23:02 AM2/15/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
pipeline-model-definition/src/test/resources/fromDockerfileInOtherDir.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/d8d42f135382a5fe5535005d49467d773daefe82
Log:
[FIXED JENKINS-41668] Add "dir" option for Dockerfile.

andrew.bayer@gmail.com (JIRA)

unread,
Feb 15, 2017, 9:26:02 AM2/15/17
to jenkinsc...@googlegroups.com
Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed

scm_issue_link@java.net (JIRA)

unread,
Feb 17, 2017, 5:08:02 AM2/17/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:

pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidatorImpl.groovy
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
pipeline-model-definition/src/test/resources/errors/dirSepInDockerfileName.groovy
pipeline-model-definition/src/test/resources/fromDockerfileInOtherDir.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/3aa4358e5d5369d2d01282d5add5934ab5a5a835
Log:
Merge pull request #107 from abayer/jenkins-41668

[FIXED JENKINS-41668] Add "dir" option for Dockerfile.

scm_issue_link@java.net (JIRA)

unread,
Mar 13, 2017, 6:39:02 PM3/13/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:

content/doc/book/pipeline/syntax.adoc
http://jenkins-ci.org/commit/jenkins.io/b13440af19a0a9ef115bb3316b361c3a6b9512fc
Log:
JENKINS-41668 Add "dir" option for Dockerfile declarative agent

Depends on
https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/107
being merged and released.

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

scm_issue_link@java.net (JIRA)

unread,
Mar 13, 2017, 6:39:03 PM3/13/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: R. Tyler Croy
Path:
content/doc/book/pipeline/syntax.adoc
http://jenkins-ci.org/commit/jenkins.io/29bf87e69645098f5f2a072e41a39c45eff6eb39
Log:
Merge pull request #588 from abayer/jenkins-41668

JENKINS-41668 Add "dir" option for Dockerfile declarative agent

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:43 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages