{"action":"created","issue":{"url":"https://api.github.com/repos/moby/moby/issues/36414","repository_url":"https://api.github.com/repos/moby/moby","labels_url":"https://api.github.com/repos/moby/moby/issues/36414/labels{/name}","comments_url":"https://api.github.com/repos/moby/moby/issues/36414/comments","events_url":"https://api.github.com/repos/moby/moby/issues/36414/events","html_url":"https://github.com/moby/moby/issues/36414","id":300252520,"number":36414,"title":"Dockerfile: standardize artefact paths for intermediate stages","user":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars2.githubusercontent.com/u/1804568?v=4","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"labels":[{"id":73616520,"url":"https://api.github.com/repos/moby/moby/labels/area/builder","name":"area/builder","color":"fbca04","default":false},{"id":439929827,"url":"https://api.github.com/repos/moby/moby/labels/area/project","name":"area/project","color":"fbca04","default":false},{"id":190258833,"url":"https://api.github.com/repos/moby/moby/labels/exp/beginner","name":"exp/beginner","color":"3B8686","default":false},{"id":190274019,"url":"https://api.github.com/repos/moby/moby/labels/exp/intermediate","name":"exp/intermediate","color":"3B8686","default":false},{"id":179237356,"url":"https://api.github.com/repos/moby/moby/labels/kind/enhancement","name":"kind/enhancement","color":"E8CAAF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-26T14:10:51Z","updated_at":"2018-04-11T12:48:00Z","closed_at":null,"author_association":"MEMBER","body":"https://github.com/moby/moby/pull/35100 rewrote the Dockerfile to use multi-stage builds. Some review-comments were left.\r\n\r\nA minor enhancement/cleanup: see https://github.com/moby/moby/pull/35100#discussion_r170234813\r\n\r\nCan we standardise on an output path for artefacts? e.g. make all the build-stages output artefacts in (say) `/output/`, then we can simplify all these to\r\n\r\n```Dockerfile\r\nCOPY --from=foo /output/ /usr/local/bin/\r\nCOPY --from=bar /output/ /usr/local/bin/\r\nCOPY --from=baz /output/ /usr/local/bin/\r\nCOPY --from=bif /output/ /usr/local/bin/\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/moby/moby/issues/comments/380439408","html_url":"https://github.com/moby/moby/issues/36414#issuecomment-380439408","issue_url":"https://api.github.com/repos/moby/moby/issues/36414","id":380439408,"user":{"login":"j-haj","id":3361501,"avatar_url":"https://avatars2.githubusercontent.com/u/3361501?v=4","gravatar_id":"","url":"https://api.github.com/users/j-haj","html_url":"https://github.com/j-haj","followers_url":"https://api.github.com/users/j-haj/followers","following_url":"https://api.github.com/users/j-haj/following{/other_user}","gists_url":"https://api.github.com/users/j-haj/gists{/gist_id}","starred_url":"https://api.github.com/users/j-haj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-haj/subscriptions","organizations_url":"https://api.github.com/users/j-haj/orgs","repos_url":"https://api.github.com/users/j-haj/repos","events_url":"https://api.github.com/users/j-haj/events{/privacy}","received_events_url":"https://api.github.com/users/j-haj/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T12:47:59Z","updated_at":"2018-04-11T12:47:59Z","author_association":"NONE","body":"I am almost done but have a quick question regarding  the build for `registry` -- there are two commands, one that is conditional on the architecture. \r\n```Dockerfile\r\nRUN set -x \\\r\n\t&& export GOPATH=\"$(mktemp -d)\" \\\r\n\t&& git clone https://github.com/docker/distribution.git \"$GOPATH/src/github.com/docker/distribution\" \\\r\n\t&& (cd \"$GOPATH/src/github.com/docker/distribution\" && git checkout -q \"$REGISTRY_COMMIT\") \\\r\n\t&& GOPATH=\"$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH\" \\\r\n\t\tgo build -buildmode=pie -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \\\r\n\t&& case $(dpkg --print-architecture) in \\\r\n\t\tamd64|ppc64*|s390x) \\\r\n\t\t(cd \"$GOPATH/src/github.com/docker/distribution\" && git checkout -q \"$REGISTRY_COMMIT_SCHEMA1\"); \\\r\n\t\tGOPATH=\"$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH\"; \\\r\n\t\t\tgo build -buildmode=pie -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry; \\\r\n\t\t;; \\\r\n\t   esac \\\r\n\t&& rm -rf \"$GOPATH\"\r\n```\r\nThe current approach is to create two different build directories. I don't see an obvious way around this without specializing the `COPY` source directory.\r\n\r\nOne alternative, which seems excessive, is to break this instruction into two separate instructions with the second instruction handling the schema-1 case. If we are on the correct platform (amd64, ppc64, or s390x) the build will complete, otherwise it will essentially be empty. The `COPY` instruction would then be broken into two instructions, eg:\r\n\r\n```Dockerfile\r\nCOPY --from=registry /build/ /usr/local/bin\r\nCOPY --from=registry-schema1 /build/ /usr/local/bin\r\n```\r\n\r\nOn the other hand, it still seems like the binary names would clash (with the schema 1 binaries overwriting the binaries from `registry`). Is the intended result for the schema1 binaries to overwrite in the event they are built?\r\n\r\nAny suggestions/thoughts? @thaJeztah @cpuguy83 \r\n\r\nOnce this is resolved I should have a PR out today."}}
{"actor":{"display_login":"j-haj"}}