Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions pkg/docker/Dockerfile

This file was deleted.

1 change: 1 addition & 0 deletions pkg/docker/Dockerfile
14 changes: 14 additions & 0 deletions pkg/docker/Dockerfile-trusty
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# To use directly, run: docker build --build-arg package=<pkg>.trusty.deb -t <tag> -f Dockerfile-trusty
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.


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.

ADD ${package} /stackdriver-metadata.deb
RUN apt-get update \
&& (dpkg -i /stackdriver-metadata.deb || true) \
&& apt-get install -f -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /stackdriver-metadata.deb

CMD /opt/stackdriver/metadata/sbin/metadatad

EXPOSE 8000
15 changes: 15 additions & 0 deletions pkg/docker/Dockerfile-xenial
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To use directly, run: docker build --build-arg package=<pkg>.xenial.deb -t <tag> -f Dockerfile-xenial
FROM ubuntu:xenial

ARG version=0.0.13-1
ARG package=https://storage.googleapis.com/stackdriver-container-alpha/deb/xenial/stackdriver-metadata_${version}.xenial.deb
ADD ${package} /stackdriver-metadata.deb
RUN apt-get update \
&& (dpkg -i /stackdriver-metadata.deb || true) \
&& apt-get install -f -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /stackdriver-metadata.deb

CMD /opt/stackdriver/metadata/sbin/metadatad

EXPOSE 8000
17 changes: 15 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ PKG_VERSION=0.0.13
PKG_RELEASE=1
PKG_MAINTAINER=Stackdriver Engineering <engineering@stackdriver.com>

DOCKER_VERSION=0.2
DOCKER_IMAGE=us.gcr.io/container-monitoring-storage/stackdriver-metadata-agent
DOCKER_TAG=$(DOCKER_VERSION)-$(PKG_VERSION)-$(PKG_RELEASE)

PKG_TMPDIR=$$(mktemp -d --tmpdir metadata-build.XXXXXXXXXX)

DEB_PKG=$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)$(if $(DISTRO),.$(DISTRO),).deb
RPM_PKG=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)$(if $(DISTRO),.$(DISTRO),).x86_64.rpm

$(DEB_PKG): metadatad $(wildcard ../pkg/deb/debian/*) Makefile
export TMPDIR=$(PKG_TMPDIR) && \
TMPDIR=$(PKG_TMPDIR) && export TMPDIR && \
export DEB_DIR=$$TMPDIR/deb && \
mkdir -p $$DEB_DIR/package && \
$(MAKE) DESTDIR=$$DEB_DIR/package install && \
Expand All @@ -94,7 +98,7 @@ $(DEB_PKG): metadatad $(wildcard ../pkg/deb/debian/*) Makefile
deb: $(DEB_PKG)

$(RPM_PKG): metadatad $(wildcard ../pkg/rpm/*) Makefile
export TMPDIR=$(PKG_TMPDIR) && \
TMPDIR=$(PKG_TMPDIR) && export TMPDIR && \
export RPM_DIR=$$TMPDIR/rpm && \
mkdir -p $$RPM_DIR/package && \
$(MAKE) DESTDIR=$$RPM_DIR/package install && \
Expand All @@ -103,6 +107,15 @@ $(RPM_PKG): metadatad $(wildcard ../pkg/rpm/*) Makefile

rpm: $(RPM_PKG)

docker: $(DEB_PKG) ../pkg/docker/Dockerfile-$(DISTRO)
TMPDIR=$(PKG_TMPDIR) && export TMPDIR && \
export DOCKER_DIR=$$TMPDIR/docker && \
mkdir -p $$DOCKER_DIR && \
cp ../pkg/docker/Dockerfile-$(DISTRO) $$DOCKER_DIR/Dockerfile && \
cp $(DEB_PKG) $$DOCKER_DIR/ && \
docker build --build-arg package="$(DEB_PKG)" -t $(DOCKER_IMAGE):$(DOCKER_TAG) $$DOCKER_DIR && \
$(RM) -r $$TMPDIR

clean:
$(RM) metadatad $(OBJS)

Expand Down