-
Notifications
You must be signed in to change notification settings - Fork 979
/
Dockerfile
104 lines (89 loc) · 4.8 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright 2020-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file.
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
# See the License for the specific language governing permissions and limitations under the License.
FROM public.ecr.aws/lambda/nodejs:18-arm64 AS core
# Install SSH, and other utilities
RUN set -ex \
&& yum install -y -q openssh-clients \
&& mkdir ~/.ssh \
&& mkdir -p /opt/tools \
&& mkdir -p /codebuild/image/config \
&& touch ~/.ssh/known_hosts \
&& 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 \
&& rpm --import https://download.mono-project.com/repo/xamarin.gpg \
&& curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo \
&& yum groupinstall -y -q "Development tools" \
&& yum install -y -q \
ImageMagick asciidoc bzip2-devel cvs cvsps \
docbook-dtds docbook-style-xsl e2fsprogs expat-devel expect fakeroot \
glib2-devel groff gzip icu iptables jq krb5-server libargon2-devel \
libcurl-devel libdb-devel libedit-devel libevent-devel libffi-devel \
libicu-devel libjpeg-devel libpng-devel libserf sqlite-devel \
libtidy-devel libunwind libwebp-devel libxml2-devel libxslt libxslt-devel \
libyaml-devel libzip-devel mariadb105-devel mercurial mlocate \
ncurses-devel oniguruma-devel openssl openssl-devel perl-DBD-SQLite \
perl-DBI perl-HTTP-Date perl-TimeDate perl-YAML-LibYAML \
postgresql-devel procps-ng python-configobj readline-devel rsync sgml-common \
subversion-perl tar tcl tk vim wget which xfsprogs xmlto xorg-x11-server-Xvfb xz-devel \
amazon-ecr-credential-helper \
&& rm /etc/yum.repos.d/mono-centos7-stable.repo
RUN /usr/sbin/useradd codebuild-user
ENV HOME="/tmp"
ENV LAMBDA_USER_HOME="/tmp/opt"
#=======================End of layer: core =================
FROM core AS tools
# Install Git
RUN set -ex \
&& GIT_VERSION=2.41.0 \
&& GIT_TAR_FILE=git-$GIT_VERSION.tar.gz \
&& GIT_SRC=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz \
&& curl -L -o $GIT_TAR_FILE $GIT_SRC \
&& tar zxf $GIT_TAR_FILE \
&& cd git-$GIT_VERSION \
&& make -j4 prefix=/usr \
&& make install prefix=/usr \
&& cd .. && rm -rf git-$GIT_VERSION \
&& rm -rf $GIT_TAR_FILE /tmp/*
# Install AWS CLI v2
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
RUN curl https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip -o /tmp/awscliv2.zip \
&& unzip -q /tmp/awscliv2.zip -d /opt \
&& /opt/aws/install --update -i /usr/local/aws-cli -b /usr/local/bin \
&& rm /tmp/awscliv2.zip \
&& rm -rf /opt/aws \
&& aws --version
## Install AWS SAM CLI
RUN yum install -y python3 python3-devel \
&& pip3 install --upgrade pip \
&& pip3 install aws-sam-cli \
&& sam --version
# AWS Tools
# 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
RUN curl -sS -o /usr/local/bin/aws-iam-authenticator https://s3.us-west-2.amazonaws.com/amazon-eks/1.27.1/2023-04-19/bin/linux/arm64/aws-iam-authenticator \
&& curl -sS -o /usr/local/bin/kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.27.1/2023-04-19/bin/linux/arm64/kubectl \
&& curl -sS -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-arm64-latest \
&& curl -sS -L https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_arm64.tar.gz | tar xz -C /usr/local/bin \
&& chmod +x /usr/local/bin/kubectl /usr/local/bin/aws-iam-authenticator /usr/local/bin/ecs-cli /usr/local/bin/eksctl
#======================= End of layer: tools =================
FROM tools AS node_runtime
RUN yum install -y https://dl.fedoraproject.org/pub/epel/8/Modular/aarch64/Packages/l/libuv-1.43.0-2.module_el8+13804+34326f90.aarch64.rpm \
&& npm install -g yarn \
&& yarn --version \
&& npm config --global set prefix $LAMBDA_USER_HOME/npm \
&& rm -fr /tmp/*
ENV PATH="$LAMBDA_USER_HOME/npm/bin:$PATH"
#=======================End of layer: node_runtime =================
FROM node_runtime AS al_v1
COPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txt
# Cleanup
RUN rm -fr /tmp/*
#=======================End of layer: al_lambda_v1 =================