Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify to work with AWS ECS #300

Merged
merged 3 commits into from
Jan 14, 2018
Merged
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions app/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/bash
# shellcheck disable=SC2155
# shellcheck disable=SC2155,SC2002

set -u
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change was to make it not error on "${DOCKER_PROVIDER,,}" which is possibly unbound (but actually is not because of the -n sanity)

set -e

export CONTAINER_ID=$(cat /proc/self/cgroup | sed -nE 's/^.+docker[\/-]([a-f0-9]{64}).*/\1/p' | head -n 1)
if [[ -n "${DOCKER_PROVIDER}" ]] && [[ "${DOCKER_PROVIDER,,}" == "aws" ]]; then
export CONTAINER_ID=$(cat "${ECS_CONTAINER_METADATA_FILE}" | grep ContainerID | sed 's/.*: "\(.*\)",/\1/g')
else
export CONTAINER_ID=$(cat /proc/self/cgroup | sed -nE 's/^.+docker[\/-]([a-f0-9]{64}).*/\1/p' | head -n 1)
fi

if [[ -z "$CONTAINER_ID" ]]; then
echo "Error: can't get my container ID !" >&2
Expand Down