Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
83 lines (70 loc) · 2.44 KB
/
Copy pathDockerfile
File metadata and controls
83 lines (70 loc) · 2.44 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
74
75
76
77
78
79
80
81
82
83
# Stage 1: build plabs binary
FROM golang:1.25 AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /plabs ./cmd/plabs
# Stage 2: runtime image
FROM debian:bookworm-slim
# Match the version plabs downloads so there's no mismatch when used as fallback.
# plabs prefers its own managed binary (~/.plabs/bin/terraform); this is the
# system fallback for first-run scenarios before plabs init has been run.
ARG TERRAFORM_VERSION=1.7.0
ARG TARGETARCH
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
git \
jq \
python3 \
python3-pip \
unzip \
zip \
&& rm -rf /var/lib/apt/lists/*
# Install Terraform
RUN set -eux; \
ARCH=$(dpkg --print-architecture); \
case "$ARCH" in \
amd64) TF_ARCH="amd64" ;; \
arm64) TF_ARCH="arm64" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac; \
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${TF_ARCH}.zip" \
-o /tmp/terraform.zip && \
unzip /tmp/terraform.zip -d /usr/local/bin && \
rm /tmp/terraform.zip && \
terraform version
# Install AWS CLI v2
RUN set -eux; \
ARCH=$(dpkg --print-architecture); \
case "$ARCH" in \
amd64) AWS_ARCH="x86_64" ;; \
arm64) AWS_ARCH="aarch64" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac; \
curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-${AWS_ARCH}.zip" \
-o /tmp/awscliv2.zip && \
unzip /tmp/awscliv2.zip -d /tmp && \
/tmp/aws/install && \
rm -rf /tmp/awscliv2.zip /tmp/aws && \
aws --version
# Install AWS SSM Session Manager plugin (required for `aws ssm start-session`)
RUN set -eux; \
ARCH=$(dpkg --print-architecture); \
case "$ARCH" in \
amd64) SSM_ARCH="ubuntu_64bit" ;; \
arm64) SSM_ARCH="ubuntu_arm64" ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac; \
curl -fsSL "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/${SSM_ARCH}/session-manager-plugin.deb" \
-o /tmp/session-manager-plugin.deb && \
dpkg -i /tmp/session-manager-plugin.deb && \
rm /tmp/session-manager-plugin.deb && \
session-manager-plugin --version
COPY --from=builder /plabs /usr/local/bin/plabs
ENV TERM=xterm-256color
ENV HOME=/root
ENTRYPOINT ["bash"]