-
Notifications
You must be signed in to change notification settings - Fork 11
Allow generating the docker image via make. #31
Conversation
Remove the package from the docker image once installed.
| @@ -0,0 +1,13 @@ | |||
| FROM ubuntu:trusty | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a comment of some sort saying that this dockerfile cannot be used directly and is used as a part of the Makefile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can absolutely use this directly:
curl -O http://.../stackdriver-metadata_${version}.trusty.deb \
&& docker build --build-arg package=stackdriver-metadata_${version}.trusty.deb -t stackdriver-metadata-agent:${version}-trusty -f Dockerfile-trusty .You just have to supply the correct parameters. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah didn't know that docker build would take a dockerfile not names Dockerfile. Can we add an instruction as a comment as to use this directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/Makefile
Outdated
|
|
||
| rpm: $(RPM_PKG) | ||
|
|
||
| ifeq ($(findstring |$(DISTRO)|,|trusty|xenial|),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we're building an image for trusty as well? Once it's in a container it shouldn't matter what the underlying distro is no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to build the container with the version of the agent you've just built locally, e.g., for testing. My machine is trusty, so the package I'll build will be for ubuntu:trusty. We should eventually add Dockerfiles for CentOS distros too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to take a step back and try to reinforce what Dhrupad said though, why don't we just make a dockerfile that encompasses the entire build itself? Being a user on mac, I certainly don't want to have to build this on my machine and then copy that package into the docker container. I have a dockerfile locally that does the entire build locally for context in paste "5195402634592256"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add one like that as well. But the purpose of these specific Dockerfiles is to build locally. I'm happy to put them into a subdirectory of pkg/docker, e.g., pkg/docker/local if you want them distinct from the "official" Dockerfiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After an offline discussion, unified the "official" Dockerfile with Dockerfile-xenial. The issue with hermetic build is orthogonal to this, so let's address that separately.
dhrupadb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👌
| @@ -0,0 +1,13 @@ | |||
| FROM ubuntu:trusty | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah didn't know that docker build would take a dockerfile not names Dockerfile. Can we add an instruction as a comment as to use this directly?
src/Makefile
Outdated
|
|
||
| rpm: $(RPM_PKG) | ||
|
|
||
| ifeq ($(findstring |$(DISTRO)|,|trusty|xenial|),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks.
igorpeshansky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments. PTAL.
| @@ -0,0 +1,13 @@ | |||
| FROM ubuntu:trusty | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
qingling128
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…ntainer package filename.
igorpeshansky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed feedback. PTAL.
src/Makefile
Outdated
|
|
||
| rpm: $(RPM_PKG) | ||
|
|
||
| ifeq ($(findstring |$(DISTRO)|,|trusty|xenial|),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After an offline discussion, unified the "official" Dockerfile with Dockerfile-xenial. The issue with hermetic build is orthogonal to this, so let's address that separately.
igorpeshansky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the build even simpler. PTAL.
| # To use directly, run: docker build --build-arg package=<pkg>.trusty.deb -t <tag> -f Dockerfile-trusty | ||
| FROM ubuntu:trusty | ||
|
|
||
| ARG package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not have a default package to set this to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for trusty. Our official packages are only xenial and centos7.
|
|
||
| ARG package | ||
| COPY ${package} /stackdriver-metadata.deb | ||
| RUN apt-get update \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure consistency going forward, should we have an install.sh in this directory that runs these commands, and change this to something like below? If you feel it's better to be explicit that's fine by me too, just throwing out the idea.
ADD install.sh
RUN bash install.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commands are different for different install schemas. We'd have to have two install.sh scripts, so we might as well embed the commands in the Dockerfiles.
igorpeshansky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Responded. PTAL.
| # To use directly, run: docker build --build-arg package=<pkg>.trusty.deb -t <tag> -f Dockerfile-trusty | ||
| FROM ubuntu:trusty | ||
|
|
||
| ARG package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for trusty. Our official packages are only xenial and centos7.
|
|
||
| ARG package | ||
| COPY ${package} /stackdriver-metadata.deb | ||
| RUN apt-get update \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commands are different for different install schemas. We'd have to have two install.sh scripts, so we might as well embed the commands in the Dockerfiles.
pkg/docker/Dockerfile-trusty
Outdated
| FROM ubuntu:trusty | ||
|
|
||
| ARG package | ||
| COPY ${package} /stackdriver-metadata.deb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final nit: we should use "ADD" in both Dockerfiles, just to allow for the flexibility if their parameter is indeed a URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, right you are. That wasn't intentional. Fixed.
dhrupadb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending resolution of remaining comments, LGTM 👌
bmoyles0117
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Remove the package from the docker image once installed.