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
8 changes: 5 additions & 3 deletions pkg/docker/Dockerfile-xenial
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# To use directly, run: docker build --build-arg package=<pkg>.xenial.deb -t <tag> -f Dockerfile-xenial
FROM ubuntu:xenial

EXPOSE 8000

ARG version=0.0.19-1
ARG package=https://storage.googleapis.com/stackdriver-container-alpha/deb/xenial/stackdriver-metadata_${version}.xenial.deb
ADD ${package} /stackdriver-metadata.deb
Expand All @@ -9,7 +11,7 @@ RUN apt-get update \
&& apt-get install -f -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /stackdriver-metadata.deb
COPY entrypoint.sh /entrypoint.sh

CMD /opt/stackdriver/metadata/sbin/metadatad

EXPOSE 8000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/opt/stackdriver/metadata/sbin/metadatad"]
21 changes: 21 additions & 0 deletions pkg/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
set -e

# This docker image supports sending either a flag or a command as the docker
# command. When a flag is sent, it will be passed on to the metadata agent
# process. Anything else will be interpreted as the command to be run.
#
# Passing a flag.
# $ docker run -it {image:tag} -v
#
# Passing a command.
# $ docker run -it {image:tag} /bin/bash
#
# Default behavior uses CMD defined in Dockerfile.
# $ docker run -it {image:tag}
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is not related to the following if, so let's add a blank line after it.

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.


if [ "${1:0:1}" = '-' ]; then
set -- /opt/stackdriver/metadata/sbin/metadatad "$@"
fi

exec "$@"