diff --git a/.dockerignore b/.dockerignore index e407a3ae06561d7a615fed10f9717012294fb8c9..c73c221d9caeb3c5ead92490f33276062c249fce 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ * !awslogs.conf !config -!deduce-aws-region +!deduce_aws_region !entrypoint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16add03b54d90de7936df1b14a5bcb2b9f490368..f2fe655830f6a2b827ae3470fb342ed067181fbc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,8 +45,6 @@ repos: rev: v0.3.0 hooks: - id: hadolint - - id: docker-compose - - repo: https://github.com/ambv/black rev: 20.8b1 diff --git a/Dockerfile b/Dockerfile index 61b8321368904da38ef4d46839c0b2378634dca1..b3e39ae41ceefbcc2cc65f96300731d4a9b7fec0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN pip install --no-cache-dir --progress-bar=off \ COPY --chown=root:root config /etc/aws/ COPY --chown=root:root entrypoint /usr/local/bin/ COPY --chown=root:root awslogs.conf /var/awslogs/etc/awslogs.conf.j2 -COPY --chown=root:root deduce-aws-region /usr/local/bin/ +COPY --chown=root:root deduce_aws_region /usr/local/bin/ USER nobody ENV AWS_CONFIG_FILE="/etc/aws/config" \ LOG_GROUP_NAME="" \ diff --git a/deduce-aws-region b/deduce_aws_region similarity index 88% rename from deduce-aws-region rename to deduce_aws_region index 75d45c347bdd25e3e048a9d58c3abe38108ae169..f616d76074c02c4b9f9a5e9c5aabe7f07e5a87ce 100755 --- a/deduce-aws-region +++ b/deduce_aws_region @@ -4,7 +4,7 @@ from urllib.request import urlopen import json if __name__ == "__main__": - response = urlopen( + response = urlopen( # nosec "http://169.254.169.254/latest/dynamic/instance-identity/document" ) print(json.loads(response.read().decode("utf-8"))["region"]) diff --git a/entrypoint b/entrypoint index 86da6d3c48c3736588c6322c5ec717404861fb79..d1dcacdcd7a61fd5c6801ed55859e4564a07c843 100755 --- a/entrypoint +++ b/entrypoint @@ -3,7 +3,7 @@ set -eux template /var/awslogs/etc/awslogs.conf.j2 > /tmp/config if [ -z "${AWS_DEFAULT_REGION:-}" ] then - AWS_DEFAULT_REGION="$(deduce-aws-region)" + AWS_DEFAULT_REGION="$(deduce_aws_region)" export AWS_DEFAULT_REGION fi eval exec "$@"