Skip to content

Commit

Permalink
Fix SAM CLI installation and add Docker entrypoint to corretto images (
Browse files Browse the repository at this point in the history
  • Loading branch information
leoherran-aws authored Jul 28, 2023
1 parent 3228c52 commit c32d029
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 12 deletions.
8 changes: 5 additions & 3 deletions al2/x86_64/standard/5.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,17 @@ RUN rbenv install $RUBY_32_VERSION && rm -rf /tmp/* && rbenv global $RUBY_32_VER
#Python 3.11
ENV PYTHON_311_VERSION="3.11.4"
ENV PYTHON_PIP_VERSION=23.1.2
ENV PYYAML_VERSION=6.0
ENV PYYAML_VERSION=5.4.1

COPY tools/runtime_configs/python/$PYTHON_311_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_311_VERSION
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_311_VERSION && rm -rf /tmp/*
RUN pyenv global $PYTHON_311_VERSION
RUN set -ex \
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' wheel aws-sam-cli boto3 pipenv virtualenv \
&& pip3 install --no-cache-dir --upgrade "PyYAML==$PYYAML_VERSION"
&& pip3 install wheel \
&& pip3 install --no-build-isolation "Cython<3" "PyYAML==$PYYAML_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' aws-sam-cli boto3 pipenv virtualenv \
&& pip3 uninstall cython --yes

#**************** END PYTHON *****************************************************

Expand Down
6 changes: 4 additions & 2 deletions al2/x86_64/standard/corretto11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN set -ex \
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H github.com >> ~/.ssh/known_hosts \
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H bitbucket.org >> ~/.ssh/known_hosts \
&& chmod 600 ~/.ssh/known_hosts \
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel iptables

RUN useradd codebuild-user

Expand Down Expand Up @@ -111,6 +111,8 @@ RUN set -ex \
# Configure SSH
COPY ssh_config /root/.ssh/config
COPY runtimes.yml /codebuild/image/config/runtimes.yml
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh
COPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txt

ENTRYPOINT ["sh","-c"]
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]
23 changes: 23 additions & 0 deletions al2/x86_64/standard/corretto11/dockerd-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

/usr/local/bin/dockerd \
--host=unix:///var/run/docker.sock \
--host=tcp://127.0.0.1:2375 \
--storage-driver=overlay2 &>/var/log/docker.log &


tries=0
d_timeout=60
until docker info >/dev/null 2>&1
do
if [ "$tries" -gt "$d_timeout" ]; then
cat /var/log/docker.log
echo 'Timed out trying to connect to internal docker host.' >&2
exit 1
fi
tries=$(( $tries + 1 ))
sleep 1
done

eval "$@"
6 changes: 4 additions & 2 deletions al2/x86_64/standard/corretto8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN set -ex \
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H github.com >> ~/.ssh/known_hosts \
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H bitbucket.org >> ~/.ssh/known_hosts \
&& chmod 600 ~/.ssh/known_hosts \
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel iptables

RUN useradd codebuild-user

Expand Down Expand Up @@ -111,6 +111,8 @@ RUN set -ex \
# Configure SSH
COPY ssh_config /root/.ssh/config
COPY runtimes.yml /codebuild/image/config/runtimes.yml
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh
COPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txt

ENTRYPOINT ["sh","-c"]
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]
23 changes: 23 additions & 0 deletions al2/x86_64/standard/corretto8/dockerd-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

/usr/local/bin/dockerd \
--host=unix:///var/run/docker.sock \
--host=tcp://127.0.0.1:2375 \
--storage-driver=overlay2 &>/var/log/docker.log &


tries=0
d_timeout=60
until docker info >/dev/null 2>&1
do
if [ "$tries" -gt "$d_timeout" ]; then
cat /var/log/docker.log
echo 'Timed out trying to connect to internal docker host.' >&2
exit 1
fi
tries=$(( $tries + 1 ))
sleep 1
done

eval "$@"
6 changes: 4 additions & 2 deletions ubuntu/standard/6.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_310_VERS
RUN pyenv global $PYTHON_310_VERSION
RUN set -ex \
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
&& pip3 install --no-cache-dir --upgrade "PyYAML==$PYYAML_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==62.6.0' wheel aws-sam-cli boto3 pipenv virtualenv
&& pip3 install wheel \
&& pip3 install --no-build-isolation "Cython<3" "PyYAML==$PYYAML_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==62.6.0' aws-sam-cli boto3 pipenv virtualenv \
&& pip3 uninstall cython --yes

#**************** END PYTHON *****************************************************

Expand Down
8 changes: 5 additions & 3 deletions ubuntu/standard/7.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,17 @@ RUN rbenv install $RUBY_32_VERSION && rm -rf /tmp/* \
ENV PYTHON_311_VERSION="3.11.4"

ARG PYTHON_PIP_VERSION=23.1.1
ENV PYYAML_VERSION=6.0
ENV PYYAML_VERSION=5.4.1

COPY tools/runtime_configs/python/$PYTHON_311_VERSION /root/.pyenv/plugins/python-build/share/python-build/$PYTHON_311_VERSION
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_311_VERSION && rm -rf /tmp/*
RUN pyenv global $PYTHON_311_VERSION
RUN set -ex \
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' wheel aws-sam-cli boto3 pipenv virtualenv \
&& pip3 install --no-cache-dir --upgrade "PyYAML==$PYYAML_VERSION"
&& pip3 install wheel \
&& pip3 install --no-build-isolation "Cython<3" "PyYAML==$PYYAML_VERSION" \
&& pip3 install --no-cache-dir --upgrade 'setuptools==67.7.2' aws-sam-cli boto3 pipenv virtualenv \
&& pip3 uninstall cython --yes

#**************** END PYTHON *****************************************************

Expand Down

0 comments on commit c32d029

Please sign in to comment.