Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@igorpeshansky
Copy link
Contributor

Remove the package from the docker image once installed.

Remove the package from the docker image once installed.
@@ -0,0 +1,13 @@
FROM ubuntu:trusty
Copy link
Contributor

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.

Copy link
Contributor Author

@igorpeshansky igorpeshansky Sep 15, 2017

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. :-)

Copy link
Contributor

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?

Copy link
Contributor Author

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|),)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks.

Copy link
Contributor

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"

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@dhrupadb dhrupadb left a 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
Copy link
Contributor

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|),)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks.

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

@qingling128 qingling128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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|),)
Copy link
Contributor Author

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.

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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
Copy link
Contributor

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?

Copy link
Contributor Author

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 \
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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
Copy link
Contributor Author

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 \
Copy link
Contributor Author

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.

FROM ubuntu:trusty

ARG package
COPY ${package} /stackdriver-metadata.deb
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@dhrupadb dhrupadb left a 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 👌

Copy link
Contributor

@bmoyles0117 bmoyles0117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@igorpeshansky igorpeshansky merged commit 10bd4ff into master Sep 16, 2017
@igorpeshansky igorpeshansky deleted the igorp-docker-make branch September 16, 2017 00:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants