-
Notifications
You must be signed in to change notification settings - Fork 979
/
Dockerfile
139 lines (120 loc) · 6.52 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# 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/dotnet:6-x86_64 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-x86_64.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 wget -nv https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -O /tmp/samcli.zip \
&& unzip -q /tmp/samcli.zip -d /opt \
&& /opt/install --update -i /usr/local/sam-cli -b /usr/local/bin \
&& rm /tmp/samcli.zip /opt/install \
&& rm -rf /opt/aws-sam-cli-src \
&& 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/amd64/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/amd64/kubectl \
&& curl -sS -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest \
&& curl -sS -L https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_amd64.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 dotnet_runtime
ENV DOTNET_SDK_VERSION "6.0.413"
ENV DOTNET_SDK_DOWNLOAD_URL "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz"
ENV DOTNET_SDK_DOWNLOAD_SHA512 "ee0a77d54e6d4917be7310ff0abb3bad5525bfb4beb1db0c215e65f64eb46511f5f12d6c7ff465a1d4ab38577e6a1950fde479ee94839c50e627020328a702de"
ENV DOTNET_DIR "/var/lang/bin"
RUN set -ex \
&& curl -SL $DOTNET_SDK_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_SDK_DOWNLOAD_SHA512 dotnet.tar.gz" | sha512sum -c - \
&& tar -zxf dotnet.tar.gz -C $DOTNET_DIR \
&& rm dotnet.tar.gz
# Add .NET Core Global Tools install folder to PATH
ENV DOTNET_CLI_HOME=$LAMBDA_USER_HOME \
PATH="$LAMBDA_USER_HOME/.dotnet/tools:$PATH"
# Trigger the population of the local package cache
ENV NUGET_XMLDOC_MODE skip
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT true
RUN set -ex \
&& mkdir warmup \
&& cd warmup \
&& dotnet new \
&& cd .. \
&& rm -rf warmup \
&& rm -rf /tmp/NuGetScratch
# Install Powershell Core
# See instructions at https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux
ENV POWERSHELL_VERSION 7.3.6
ENV POWERSHELL_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$POWERSHELL_VERSION/powershell-$POWERSHELL_VERSION-linux-x64.tar.gz
ENV POWERSHELL_DOWNLOAD_SHA 38BFBA9AA4C914ADF9F9A64B7F5832F8533305B696B5F03D0C3D56F9A2D8A5DC
RUN set -ex \
&& curl -SL $POWERSHELL_DOWNLOAD_URL --output powershell.tar.gz \
&& echo "$POWERSHELL_DOWNLOAD_SHA powershell.tar.gz" | sha256sum -c - \
&& mkdir -p /opt/microsoft/powershell/$POWERSHELL_VERSION \
&& tar zxf powershell.tar.gz -C /opt/microsoft/powershell/$POWERSHELL_VERSION \
&& rm powershell.tar.gz \
&& ln -s /opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh /usr/bin/pwsh \
&& pwsh --version
#=======================End of layer: dotnet_runtime =================
FROM dotnet_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 =================