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

Conversation

@bmoyles0117
Copy link
Contributor

No description provided.

Copy link

@jkohen jkohen left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, Bryan.

ARG version=0.0.13-5
EXPOSE 8000

ARG version=0.0.13-3
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this way out of date now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

#!/bin/sh
set -e

# first arg is a flag.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: capitalize "First".

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.

set -e

# first arg is a flag.
if [ "${1:0:1}" = '-' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a bash-ism? If so, should the shebang be #!/bin/bash instead?

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.

set -e

# first arg is a flag.
if [ "${1:0:1}" = '-' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

What if there isn't a first argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean. Please see if the latest update addresses your concerns.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was worried that a missing $1 would cause it to error out when nounset is in effect, but that seems to be ignored for substring substitutions (i.e., echo "${1}" would produce a "1: unbound variable" error, but echo ${1:0:1} will happily print an empty string). So never mind.

Copy link
Contributor

@igorpeshansky igorpeshansky Jul 12, 2018

Choose a reason for hiding this comment

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

@bmoyles0117 Just noticed that this is a bash-ism, and you set the shell to /bin/sh. I got Bad substitution errors on this line in the latest container.
I've sent #161 to fix.

@bmoyles0117 bmoyles0117 force-pushed the bmoyles0117-docker-entrypoint branch from 65b8b2c to 1b1c892 Compare May 22, 2018 19:03
@bmoyles0117 bmoyles0117 changed the title Add docker-entrypoint.sh to abstract around metadatad binary. Add entrypoint.sh to abstract around metadatad binary. May 22, 2018
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.

&& apt-get install -f -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /stackdriver-metadata.deb
ADD entrypoint.sh /entrypoint.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a local file — let's use COPY.

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.

# $ 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.

set -- /opt/stackdriver/metadata/sbin/metadatad "$@"
fi

exec "$@" No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the trailing newline...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please understand that I don't do this intentionally :)

set -e

# first arg is a flag.
if [ "${1:0:1}" = '-' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I was worried that a missing $1 would cause it to error out when nounset is in effect, but that seems to be ignored for substring substitutions (i.e., echo "${1}" would produce a "1: unbound variable" error, but echo ${1:0:1} will happily print an empty string). So never mind.

Copy link
Contributor

@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.

LGTM :shipit:

@bmoyles0117 bmoyles0117 merged commit 89edd20 into master May 22, 2018
@igorpeshansky igorpeshansky deleted the bmoyles0117-docker-entrypoint branch July 12, 2018 16:56
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