Skip to content

Commit c32d029

Browse files
Fix SAM CLI installation and add Docker entrypoint to corretto images (#661)
1 parent 3228c52 commit c32d029

File tree

7 files changed

+68
-12
lines changed

7 files changed

+68
-12
lines changed

al2/x86_64/standard/5.0/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,17 @@ RUN rbenv install $RUBY_32_VERSION && rm -rf /tmp/* && rbenv global $RUBY_32_VER
277277
#Python 3.11
278278
ENV PYTHON_311_VERSION="3.11.4"
279279
ENV PYTHON_PIP_VERSION=23.1.2
280-
ENV PYYAML_VERSION=6.0
280+
ENV PYYAML_VERSION=5.4.1
281281

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

290292
#**************** END PYTHON *****************************************************
291293

al2/x86_64/standard/corretto11/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN set -ex \
2222
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H github.com >> ~/.ssh/known_hosts \
2323
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H bitbucket.org >> ~/.ssh/known_hosts \
2424
&& chmod 600 ~/.ssh/known_hosts \
25-
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel
25+
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel iptables
2626

2727
RUN useradd codebuild-user
2828

@@ -111,6 +111,8 @@ RUN set -ex \
111111
# Configure SSH
112112
COPY ssh_config /root/.ssh/config
113113
COPY runtimes.yml /codebuild/image/config/runtimes.yml
114+
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh
115+
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh
114116
COPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txt
115117

116-
ENTRYPOINT ["sh","-c"]
118+
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
set -e
3+
4+
/usr/local/bin/dockerd \
5+
--host=unix:///var/run/docker.sock \
6+
--host=tcp://127.0.0.1:2375 \
7+
--storage-driver=overlay2 &>/var/log/docker.log &
8+
9+
10+
tries=0
11+
d_timeout=60
12+
until docker info >/dev/null 2>&1
13+
do
14+
if [ "$tries" -gt "$d_timeout" ]; then
15+
cat /var/log/docker.log
16+
echo 'Timed out trying to connect to internal docker host.' >&2
17+
exit 1
18+
fi
19+
tries=$(( $tries + 1 ))
20+
sleep 1
21+
done
22+
23+
eval "$@"

al2/x86_64/standard/corretto8/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN set -ex \
2222
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H github.com >> ~/.ssh/known_hosts \
2323
&& ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H bitbucket.org >> ~/.ssh/known_hosts \
2424
&& chmod 600 ~/.ssh/known_hosts \
25-
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel
25+
&& yum install -y -q make gettext-devel gcc openssl-devel curl-devel expat-devel iptables
2626

2727
RUN useradd codebuild-user
2828

@@ -111,6 +111,8 @@ RUN set -ex \
111111
# Configure SSH
112112
COPY ssh_config /root/.ssh/config
113113
COPY runtimes.yml /codebuild/image/config/runtimes.yml
114+
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh
115+
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh
114116
COPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txt
115117

116-
ENTRYPOINT ["sh","-c"]
118+
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
set -e
3+
4+
/usr/local/bin/dockerd \
5+
--host=unix:///var/run/docker.sock \
6+
--host=tcp://127.0.0.1:2375 \
7+
--storage-driver=overlay2 &>/var/log/docker.log &
8+
9+
10+
tries=0
11+
d_timeout=60
12+
until docker info >/dev/null 2>&1
13+
do
14+
if [ "$tries" -gt "$d_timeout" ]; then
15+
cat /var/log/docker.log
16+
echo 'Timed out trying to connect to internal docker host.' >&2
17+
exit 1
18+
fi
19+
tries=$(( $tries + 1 ))
20+
sleep 1
21+
done
22+
23+
eval "$@"

ubuntu/standard/6.0/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,10 @@ RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYTHON_310_VERS
210210
RUN pyenv global $PYTHON_310_VERSION
211211
RUN set -ex \
212212
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
213-
&& pip3 install --no-cache-dir --upgrade "PyYAML==$PYYAML_VERSION" \
214-
&& pip3 install --no-cache-dir --upgrade 'setuptools==62.6.0' wheel aws-sam-cli boto3 pipenv virtualenv
213+
&& pip3 install wheel \
214+
&& pip3 install --no-build-isolation "Cython<3" "PyYAML==$PYYAML_VERSION" \
215+
&& pip3 install --no-cache-dir --upgrade 'setuptools==62.6.0' aws-sam-cli boto3 pipenv virtualenv \
216+
&& pip3 uninstall cython --yes
215217

216218
#**************** END PYTHON *****************************************************
217219

ubuntu/standard/7.0/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,17 @@ RUN rbenv install $RUBY_32_VERSION && rm -rf /tmp/* \
203203
ENV PYTHON_311_VERSION="3.11.4"
204204

205205
ARG PYTHON_PIP_VERSION=23.1.1
206-
ENV PYYAML_VERSION=6.0
206+
ENV PYYAML_VERSION=5.4.1
207207

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

216218
#**************** END PYTHON *****************************************************
217219

0 commit comments

Comments
 (0)