Skip to content

Commit 4d86e85

Browse files
committed
create multi-platform dockerfile
1 parent 748141f commit 4d86e85

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

Diff for: Dockerfile

+32-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,39 @@
1-
FROM debian:bookworm-slim
1+
FROM --platform=$BUILDPLATFORM debian:bookworm-slim
2+
3+
ARG TARGETPLATFORM
4+
ARG BUILDPLATFORM
5+
6+
# Set the Atmos version (without the v prefix)
27
ARG ATMOS_VERSION
8+
ARG OS=linux
9+
ARG ARCH=amd64
310

4-
RUN apt-get update && apt-get install -y curl
11+
RUN apt-get update && apt-get install -y curl git
512

13+
# Install the Cloud Posse Debian repository
614
RUN curl -1sLf 'https://dl.cloudsmith.io/public/cloudposse/packages/cfg/setup/bash.deb.sh' | bash
715

8-
RUN apt-get update && apt-get install -y terraform helmfile
16+
# Install OpenTofu
17+
RUN curl -1sSLf 'https://get.opentofu.org/install-opentofu.sh' | bash -s -- --root-method none --install-method deb
18+
19+
# Install Kustomize binary (required by Helmfile)
20+
RUN curl -1sSLf "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- /usr/local/bin
21+
22+
# Install toolchain used with Atmos
23+
RUN apt-get -y install terraform kubectl helmfile helm
924

10-
ADD https://github.com/cloudposse/atmos/releases/download/${ATMOS_VERSION}/atmos_${ATMOS_VERSION}_${OS}_${ARCH} /usr/local/bin/atmos
25+
# Install the helm-diff plugin required by Helmfile
26+
RUN helm plugin install https://github.com/databus23/helm-diff
1127

12-
RUN chmod +x /usr/local/bin/atmos
28+
# Install Atmos
29+
RUN case ${TARGETPLATFORM} in \
30+
"linux/amd64") \
31+
OS=linux; ARCH=amd64 ;; \
32+
"linux/arm64") \
33+
OS=linux; ARCH=arm64 ;; \
34+
*) \
35+
echo "Unsupported platform: ${TARGETPLATFORM}" && exit 1 ;; \
36+
esac && \
37+
ATMOS_VERSION=${ATMOS_VERSION#v} && \
38+
curl -1sSLf "https://github.com/cloudposse/atmos/releases/download/v${ATMOS_VERSION}/atmos_${ATMOS_VERSION}_${OS}_${ARCH}" -o /usr/local/bin/atmos && \
39+
chmod +x /usr/local/bin/atmos

0 commit comments

Comments
 (0)