1+ # Copyright 2020-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+ #
3+ # Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License.
4+ # A copy of the License is located at
5+ #
6+ # http://aws.amazon.com/asl/
7+ #
8+ # or in the "license" file accompanying this file.
9+ # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
10+ # See the License for the specific language governing permissions and limitations under the License.
11+
12+ FROM public.ecr.aws/amazonlinux/amazonlinux:2023 AS core
13+
14+ # Install SSH, and other utilities
15+ RUN set -ex \
16+ && yum install -y -q openssh-clients \
17+ && mkdir ~/.ssh \
18+ && mkdir -p /opt/tools \
19+ && mkdir -p /codebuild/image/config \
20+ && touch ~/.ssh/known_hosts \
21+ && ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H github.com >> ~/.ssh/known_hosts \
22+ && ssh-keyscan -t rsa,dsa,ed25519,ecdsa -H bitbucket.org >> ~/.ssh/known_hosts \
23+ && chmod 600 ~/.ssh/known_hosts \
24+ && rpm --import https://download.mono-project.com/repo/xamarin.gpg \
25+ && curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo \
26+ && yum groupinstall -y -q "Development tools" \
27+ && yum install -y -q \
28+ ImageMagick asciidoc bzip2-devel cvs cvsps \
29+ docbook-dtds docbook-style-xsl e2fsprogs expat-devel expect fakeroot \
30+ glib2-devel groff gzip icu iptables jq krb5-server libargon2-devel \
31+ libcurl-devel libdb-devel libedit-devel libevent-devel libffi-devel \
32+ libicu-devel libjpeg-devel libpng-devel libserf sqlite-devel \
33+ libtidy-devel libunwind libwebp-devel libxml2-devel libxslt libxslt-devel \
34+ libyaml-devel libzip-devel mariadb105-devel mercurial mlocate \
35+ ncurses-devel oniguruma-devel openssl openssl-devel perl-DBD-SQLite \
36+ perl-DBI perl-HTTP-Date perl-TimeDate perl-YAML-LibYAML \
37+ postgresql-devel procps-ng python-configobj readline-devel rsync sgml-common \
38+ subversion-perl tar tcl tk vim wget which xfsprogs xmlto xorg-x11-server-Xvfb xz-devel \
39+ amazon-ecr-credential-helper \
40+ && rm /etc/yum.repos.d/mono-centos7-stable.repo
41+
42+ RUN /usr/sbin/useradd codebuild-user
43+
44+ ENV HOME="/tmp"
45+ ENV LAMBDA_USER_HOME="/tmp/opt"
46+ # =======================End of layer: core =================
47+
48+ FROM core AS tools
49+
50+ # Install Git
51+ RUN set -ex \
52+ && GIT_VERSION=2.49.0 \
53+ && GIT_TAR_FILE=git-$GIT_VERSION.tar.gz \
54+ && GIT_SRC=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz \
55+ && curl -L -o $GIT_TAR_FILE $GIT_SRC \
56+ && tar zxf $GIT_TAR_FILE \
57+ && cd git-$GIT_VERSION \
58+ && make -j4 prefix=/usr \
59+ && make install prefix=/usr \
60+ && cd .. && rm -rf git-$GIT_VERSION \
61+ && rm -rf $GIT_TAR_FILE /tmp/*
62+
63+ # Install AWS CLI v2
64+ # https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
65+ RUN curl https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip -o /tmp/awscliv2.zip \
66+ && unzip -q /tmp/awscliv2.zip -d /opt \
67+ && /opt/aws/install --update -i /usr/local/aws-cli -b /usr/local/bin \
68+ && rm /tmp/awscliv2.zip \
69+ && rm -rf /opt/aws \
70+ && aws --version
71+
72+ # Install AWS SAM CLI
73+ RUN wget -nv https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-arm64.zip -O /tmp/samcli.zip \
74+ && unzip -q /tmp/samcli.zip -d /opt \
75+ && /opt/install --update -i /usr/local/sam-cli -b /usr/local/bin \
76+ && rm /tmp/samcli.zip /opt/install \
77+ && rm -rf /opt/aws-sam-cli-src \
78+ && sam --version
79+
80+ # AWS Tools
81+ # https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_installation.html
82+ RUN curl -sS -o /usr/local/bin/aws-iam-authenticator https://s3.us-west-2.amazonaws.com/amazon-eks/1.32.0/2024-12-20/bin/linux/arm64/aws-iam-authenticator \
83+ && curl -sS -o /usr/local/bin/kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.32.0/2024-12-20/bin/linux/arm64/kubectl \
84+ && curl -sS -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-arm64-latest \
85+ && curl -sS -L https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_arm64.tar.gz | tar xz -C /usr/local/bin \
86+ && chmod +x /usr/local/bin/kubectl /usr/local/bin/aws-iam-authenticator /usr/local/bin/ecs-cli /usr/local/bin/eksctl
87+ # ======================= End of layer: tools =================
88+
89+ FROM tools AS go_runtime
90+
91+ ENV GOLANG_VERSION="1.24.1" \
92+ GOPATH="/go" \
93+ GOLANG_DOWNLOAD_SHA256="8df5750ffc0281017fb6070fba450f5d22b600a02081dceef47966ffaf36a3af"
94+ ENV PATH="$GOPATH/bin:$LAMBDA_USER_HOME/go/bin:/usr/local/go/bin:$PATH"
95+
96+ RUN set -ex \
97+ && mkdir -p "$GOPATH/src" "$GOPATH/bin" \
98+ && chmod -R 777 "$GOPATH" \
99+ && wget "https://dl.google.com/go/go$GOLANG_VERSION.linux-arm64.tar.gz" -O /tmp/golang.tar.gz \
100+ && echo "$GOLANG_DOWNLOAD_SHA256 /tmp/golang.tar.gz" | sha256sum -c - \
101+ && tar -xzf /tmp/golang.tar.gz -C /usr/local \
102+ && go env -w GO111MODULE=auto \
103+ && rm -fr /tmp/* /var/tmp/*
104+
105+ ENV GOPATH="$GOPATH:$LAMBDA_USER_HOME/go" \
106+ GOBIN="$LAMBDA_USER_HOME/go/bin" \
107+ GOMODCACHE="$LAMBDA_USER_HOME/gomodcache"
108+ # =======================End of layer: go_runtime =================
109+
110+ FROM go_runtime AS al_v1
111+
112+ COPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txt
113+
114+ # Cleanup
115+ RUN rm -fr /tmp/*
116+ # =======================End of layer: al_lambda_v1 =================
0 commit comments