Skip to content

Commit

Permalink
ensure that al2 image is actually al2
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Dec 3, 2024
1 parent 31307c8 commit ed40c19
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/docker-images/al2-2023/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM amazonlinux:2


###############################################################################
# Install prereqs
###############################################################################
RUN yum -y update \
&& yum -y install \
tar \
git \
sudo \
# Python
python3 \
python3-devel \
python3-pip \
make \
cmake3 \
gcc \
gcc-c++ \
which \
&& yum clean all \
&& rm -rf /var/cache/yum \
&& cmake --version \
&& ctest --version

###############################################################################
# Python/AWS CLI
###############################################################################
RUN python3 -m pip install setuptools virtualenv \
&& python3 -m pip install --upgrade awscli \
&& aws --version

###############################################################################
# Install pre-built CMake
###############################################################################
WORKDIR /tmp
RUN curl -sSL https://d19elf31gohf1l.cloudfront.net/_binaries/cmake/cmake-3.13-manylinux1-x64.tar.gz -o cmake.tar.gz \
&& tar xvzf cmake.tar.gz -C /usr/local \
&& cmake --version \
&& rm -f /tmp/cmake.tar.gz

###############################################################################
# Install entrypoint
###############################################################################
ADD entrypoint.sh /usr/local/bin/builder
RUN chmod a+x /usr/local/bin/builder
ENTRYPOINT ["/usr/local/bin/builder"]
2 changes: 1 addition & 1 deletion .github/docker-images/al2-x64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM amazonlinux:latest
FROM amazonlinux:2023


###############################################################################
Expand Down
6 changes: 5 additions & 1 deletion builder/core/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def current_host():
def _discover_host():
platform = current_os()
if platform == 'linux':
if _file_contains('/etc/system-release', 'Amazon Linux release 2'):
# Note: that AL2 and AL2023 have the same substring. Check for AL2023 explicitly.
# And also check that AL2 has "2 (", which is common to all base distributions of AL2
if _file_contains('/etc/system-release', 'Amazon Linux release 2023'):
return 'al2023'
if _file_contains('/etc/system-release', 'Amazon Linux release 2 ('):
return 'al2'
if _file_contains('/etc/system-release', 'Bare Metal') or _file_contains('/etc/system-release', 'Amazon Linux AMI'):
return 'al2012'
Expand Down

0 comments on commit ed40c19

Please sign in to comment.