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.
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.
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.
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?
|
|
||
| rpm: $(RPM_PKG) | ||
|
|
||
| ifeq ($(findstring |$(DISTRO)|,|trusty|xenial|),) |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
| @@ -0,0 +1,13 @@ | |||
| FROM ubuntu:trusty | |||
There was a problem hiding this comment.
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?
|
|
||
| rpm: $(RPM_PKG) | ||
|
|
||
| ifeq ($(findstring |$(DISTRO)|,|trusty|xenial|),) |
igorpeshansky
left a comment
There was a problem hiding this comment.
Added comments. PTAL.
| @@ -0,0 +1,13 @@ | |||
| FROM ubuntu:trusty | |||
…ntainer package filename.
igorpeshansky
left a comment
There was a problem hiding this comment.
Addressed feedback. PTAL.
|
|
||
| rpm: $(RPM_PKG) | ||
|
|
||
| ifeq ($(findstring |$(DISTRO)|,|trusty|xenial|),) |
There was a problem hiding this comment.
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.
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.
Do we not have a default package to set this to?
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
| FROM ubuntu:trusty | ||
|
|
||
| ARG package | ||
| COPY ${package} /stackdriver-metadata.deb |
There was a problem hiding this comment.
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.
Whoops, right you are. That wasn't intentional. Fixed.
dhrupadb
left a comment
There was a problem hiding this comment.
Pending resolution of remaining comments, LGTM 👌
Remove the package from the docker image once installed.