generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (61 loc) · 2.38 KB
/
Dockerfile
File metadata and controls
73 lines (61 loc) · 2.38 KB
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
FROM public.ecr.aws/amazonlinux/amazonlinux:2023 AS builder
ARG SSM_AGENT_VERSION
ENV SSM_AGENT_VERSION=$SSM_AGENT_VERSION
# Validation
RUN : "${SSM_AGENT_VERSION:?SSM Agent version required to build}"
# SSM Agent is downloaded from eu-north-1 as this region gets new releases of SSM Agent first.
COPY ./hashes/ssm ./hashes
COPY ./gpg-keys/amazon-ssm-agent.gpg ./amazon-ssm-agent.gpg
RUN \
ARCH=$(uname -m | sed 's/aarch64/arm64/' | sed 's/x86_64/amd64/') && \
curl -L "https://s3.eu-north-1.amazonaws.com/amazon-ssm-eu-north-1/${SSM_AGENT_VERSION}/linux_${ARCH}/amazon-ssm-agent.rpm" \
-o "amazon-ssm-agent-${SSM_AGENT_VERSION}.${ARCH}.rpm" && \
grep "amazon-ssm-agent-${SSM_AGENT_VERSION}.${ARCH}.rpm" hashes \
| sha512sum --check - && \
rpm --import amazon-ssm-agent.gpg && \
rpm --checksig "amazon-ssm-agent-${SSM_AGENT_VERSION}.${ARCH}.rpm" && \
dnf install -y "amazon-ssm-agent-${SSM_AGENT_VERSION}.${ARCH}.rpm"
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
# IMAGE_VERSION is the assigned version of inputs for this image.
ARG IMAGE_VERSION
ENV IMAGE_VERSION=$IMAGE_VERSION
# Validation
RUN : "${IMAGE_VERSION:?IMAGE_VERSION is required to build}"
LABEL "org.opencontainers.image.version"="$IMAGE_VERSION"
# Install necessary packages
RUN dnf update -y && \
dnf install -y \
aws-cli \
jq \
util-linux \
e2fsprogs \
xfsprogs \
lvm2 \
mdadm \
rsync \
gettext \
tar \
gzip \
unzip \
&& \
dnf clean all
# Verify that all packages are installed
RUN \
command -v aws && \
command -v jq && \
command -v lsblk && \
command -v mkfs.ext4 && \
command -v mkfs.xfs && \
command -v lvm && \
command -v mdadm && \
command -v rsync && \
command -v envsubst
# Copy the wrapper script and EKS Hybrid setup scripts into the container
COPY bootstrap-script.sh /usr/local/bin/bootstrap-script.sh
COPY eks-hybrid-ssm-setup.sh /usr/local/bin/eks-hybrid-ssm-setup
COPY eks-hybrid-iam-ra-setup.sh /usr/local/bin/eks-hybrid-iam-ra-setup
COPY aws-signing-helper-update.service.in /usr/share/bootstrap/aws-signing-helper-update.service.in
# Copy the SSM agent from the builder stage
COPY --from=builder /usr/bin/amazon-ssm-agent /usr/local/bin/amazon-ssm-agent
# Set the wrapper script as the entry point
ENTRYPOINT ["/usr/local/bin/bootstrap-script.sh"]