Skip to content

Commit 622f50c

Browse files
authored
Add aws session-manager-plugin to aws image (#24)
Signed-off-by: peterdeme <snypox@gmail.com>
1 parent 01935f2 commit 622f50c

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
5454
if [ "${{ matrix.folder }}" == "aws" ]; then
5555
docker run --rm ${{ env.IMAGE_NAME }} sh -c "python3 -c \"import boto3; print(boto3.__version__)\""
56+
docker run --rm ${{ env.IMAGE_NAME }} session-manager-plugin --version
5657
fi
5758
5859
if [ "${{ matrix.folder }}" == "gcp" ]; then

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The image is pushed to the `public.ecr.aws/spacelift/runner-ansible` public repo
1515
Altogether we have 3 flavors of the image:
1616

1717
- `public.ecr.aws/spacelift/runner-ansible` - built on top of the [Spacelift Terraform runner image](https://github.com/spacelift-io/runner-terraform), with Ansible installed.
18-
- `public.ecr.aws/spacelift/runner-ansible-aws` - built on top of `runner-ansible`, with `boto3` installed.
18+
- `public.ecr.aws/spacelift/runner-ansible-aws` - built on top of `runner-ansible`, with `boto3` and [`session-manager-plugin`](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html) installed.
1919
- `public.ecr.aws/spacelift/runner-ansible-gcp` - built on top of `runner-ansible`, with `google-auth` installed.
2020

2121
## Branch Model

aws/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
ARG REPOSITORY_BASE_PATH
22

3+
FROM alpine AS ssm-builder
4+
5+
ARG TARGETARCH
6+
7+
RUN apk add dpkg curl; \
8+
if [ "$TARGETARCH" = "arm64" ]; then \
9+
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb" -o "session-manager-plugin.deb"; \
10+
else \
11+
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"; \
12+
fi; \
13+
dpkg -x session-manager-plugin.deb session-manager-plugin
14+
315
FROM ${REPOSITORY_BASE_PATH}:latest
416

17+
COPY --from=ssm-builder /session-manager-plugin/usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/bin/
18+
19+
ARG TARGETARCH
20+
21+
USER root
22+
23+
# session-manager-plugin requires gcompat on amd64
24+
RUN if [ "$TARGETARCH" = "amd64" ]; then \
25+
apk add --no-cache gcompat; \
26+
fi
27+
28+
RUN chmod +x /usr/local/bin/session-manager-plugin
29+
30+
USER spacelift
31+
532
RUN pip install boto3 --break-system-packages

0 commit comments

Comments
 (0)