# syntax = docker/dockerfile:experimental
FROM alpine:3.12.0 AS builder
ARG PULUMI_VERSION=latest
RUN apk update && \
      apk upgrade && \
      apk add \
      curl \
      make \
      libc6-compat \
      gcc \
      git
# Install the Pulumi SDK, including the CLI and language runtimes.
RUN if [ "$PULUMI_VERSION" = "latest" ]; then \
    curl -fsSL https://get.pulumi.com/ | sh; \
  else \
    curl -fsSL https://get.pulumi.com/ | sh -s -- --version $PULUMI_VERSION ; \
  fi

# The runtime container
# This is our base container, so let's copy all the runtimes to .pulumi/bin
FROM alpine:3.12.0
WORKDIR /pulumi
COPY --from=builder /root/.pulumi/bin bin

RUN apk update && \
    apk upgrade && \
    apk add \
    git \
    libc6-compat \
    ca-certificates

ENV PATH "/pulumi/bin:${PATH}"
CMD ["pulumi"]
