Skip to content

Commit e2fae05

Browse files
committed
Adding support for AmazonLinux2 standard image available in CodeBuild: /aws/codebuild/amazonlinux2-x86_64-standard:1.0
This image is available via the AWSCodeBuild console or the AWSCLI using the image name /aws/codebuild/amazonlinux2-x86_64-standard:1.0. This image includes the runtime version switcher and requires runtime-versions to be specified in the buildspec for more information look at our documentation: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-runtime-versions.html
1 parent bf530a4 commit e2fae05

File tree

7 files changed

+662
-1
lines changed

7 files changed

+662
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ Some of the images in this repository are no longer actively maintained by AWS C
3535
The following images are actively maintained by AWS CodeBuild, and are listed in the CodeBuild console.
3636

3737
+ [standard 2.0](ubuntu/standard/2.0)
38-
38+
+ [amazonlinux2-x86_64-standard:1.0](al2/x86_64/standard/1.0)

al2/x86_64/standard/1.0/Dockerfile

Lines changed: 512 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
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/1.0/runtimes.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
version: 0.1
2+
3+
runtimes:
4+
android:
5+
versions:
6+
28:
7+
requires:
8+
java: ["corretto8"]
9+
commands:
10+
- echo "Installing Android version 28 ..."
11+
java:
12+
versions:
13+
corretto11:
14+
commands:
15+
- echo "Installing Java version 11 ..."
16+
17+
- export JAVA_HOME="$JAVA_11_HOME"
18+
19+
- export JRE_HOME="$JRE_11_HOME"
20+
21+
- export JDK_HOME="$JDK_11_HOME"
22+
23+
- |-
24+
for tool_path in "$JAVA_HOME"/bin/*;
25+
do tool=`basename "$tool_path"`;
26+
if [ $tool != 'java-rmi.cgi' ];
27+
then
28+
rm -f /usr/bin/$tool /var/lib/alternatives/$tool \
29+
&& update-alternatives --install /usr/bin/$tool $tool $tool_path 20000;
30+
fi;
31+
done
32+
corretto8:
33+
commands:
34+
- echo "Installing Java version 8 ..."
35+
36+
- export JAVA_HOME="$JAVA_8_HOME"
37+
38+
- export JRE_HOME="$JRE_8_HOME"
39+
40+
- export JDK_HOME="$JDK_8_HOME"
41+
42+
- |-
43+
for tool_path in "$JAVA_8_HOME"/bin/* "$JRE_8_HOME"/bin/*;
44+
do tool=`basename "$tool_path"`;
45+
if [ $tool != 'java-rmi.cgi' ];
46+
then
47+
rm -f /usr/bin/$tool /var/lib/alternatives/$tool \
48+
&& update-alternatives --install /usr/bin/$tool $tool $tool_path 20000;
49+
fi;
50+
done
51+
golang:
52+
versions:
53+
1.12:
54+
commands:
55+
- echo "Installing Go version 1.12 ..."
56+
python:
57+
versions:
58+
3.7:
59+
commands:
60+
- echo "Installing Python version 3.7 ..."
61+
php:
62+
versions:
63+
7.3:
64+
commands:
65+
- echo "Installing PHP version 7.3 ..."
66+
ruby:
67+
versions:
68+
2.6:
69+
commands:
70+
- echo "Installing Ruby version 2.6 ..."
71+
- rbenv global 2.6.3
72+
nodejs:
73+
versions:
74+
10:
75+
commands:
76+
- echo "Installing Node.js version 10 ..."
77+
- n 10.16.0
78+
8:
79+
commands:
80+
- echo "Installing Node.js version 8 ..."
81+
- n 8.16.0
82+
docker:
83+
versions:
84+
18:
85+
commands:
86+
- echo "Installing Docker version 18 ..."
87+
dotnet:
88+
versions:
89+
2.2:
90+
commands:
91+
- echo "Installing .NET version 2.2 ..."

al2/x86_64/standard/1.0/ssh_config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Host *
2+
ConnectTimeout 10
3+
ConnectionAttempts 10
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/expect -f
2+
3+
set timeout 1800
4+
set cmd [lindex $argv 0]
5+
set licenses [lindex $argv 1]
6+
7+
spawn {*}$cmd
8+
expect {
9+
"Do you accept the license '*'*" {
10+
exp_send "y\r"
11+
exp_continue
12+
}
13+
"Accept? (y/N): " {
14+
exp_send "y\r"
15+
exp_continue
16+
}
17+
"Review licenses that have not been accepted (y/N)? " {
18+
exp_send "y\r"
19+
exp_continue
20+
}
21+
eof
22+
}
23+
24+
lassign [wait] pid spawnid os_error waitvalue
25+
26+
if {$os_error == 0} {
27+
exit $waitvalue
28+
} else {
29+
exit 1
30+
}

buildspec.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ phases:
55
commands:
66
- cd $CODEBUILD_SRC_DIR/ubuntu/standard/2.0
77
- docker build -t aws/codebuild/standard:2.0 .
8+
- cd $CODEBUILD_SRC_DIR/al2/x86_64/standard/1.0
9+
- docker build -t aws/codebuild/amazonlinux2-x86_64-standard:1.0 .

0 commit comments

Comments
 (0)