Skip to content

Commit 68629f2

Browse files
Adam Kellerbrentley
authored andcommitted
Update to Dockerfile
1 parent 218c94e commit 68629f2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get update && apt-get -y install iproute2 curl jq libgmp3-dev ruby-dev b
1414
rm -rvf /root/* /root/.gem* /var/cache/*
1515

1616
COPY . /usr/src/app
17-
RUN chmod +x /usr/src/app/startup.sh
17+
RUN chmod +x /usr/src/app/startup-cdk.sh
1818

1919
# helpful when trying to update gems -> bundle update, remove the Gemfile.lock, start ruby
2020
# RUN bundle update
@@ -23,4 +23,4 @@ RUN chmod +x /usr/src/app/startup.sh
2323
HEALTHCHECK --interval=10s --timeout=3s \
2424
CMD curl -f -s http://localhost:3000/health/ || exit 1
2525
EXPOSE 3000
26-
ENTRYPOINT ["bash","/usr/src/app/startup.sh"]
26+
ENTRYPOINT ["bash","/usr/src/app/startup-cdk.sh"]

startup-cdk.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ if [[ -z ${zone} ]]; then
8484
declare -a subnets=( $(aws ec2 describe-subnets | jq .Subnets[].CidrBlock| sed ':a;N;$!ba;s/\n/ /g') )
8585
for sub in "${subnets[@]}"; do
8686
if $(ruby -e "puts(IPAddr.new($sub.to_s).include? $ip_addr.to_s)") == 'true'; then
87-
zone=$(aws ec2 describe-subnets | jq -r ".Subnets[] | select(.CidrBlock==$sub) | .AvailabilityZone" | grep -o .$)
87+
details=$(aws ec2 describe-subnets | jq -r ".Subnets[] | select(.CidrBlock==$sub)")
88+
if [[ $(echo $details | jq .Tags) != "null" ]]; then
89+
zone=$(echo $details | jq -r 'select(.Tags[].Value=="ecsworkshop") | .AvailabilityZone' | sort -u | grep -o .$)
90+
fi
8891
fi
8992
done
9093
fi

0 commit comments

Comments
 (0)