# syntax = docker/dockerfile:experimental
# Interim container so we can copy pulumi binaries
# Must be defined first
ARG PULUMI_VERSION=latest
ARG PULUMI_IMAGE=pulumi/pulumi-base
ARG RUNTIME_VERSION=3.1
FROM ${PULUMI_IMAGE}:${PULUMI_VERSION}-ubi as pulumi

# The runtime container
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
WORKDIR /pulumi/projects

RUN --mount=target=/var/cache/yum,type=cache \
    microdnf install -y \
    ca-certificates \
    tar \
    dotnet-sdk-3.1 \
    git

# Uses the workdir, copies from pulumi interim container
COPY --from=pulumi /pulumi/bin/pulumi /pulumi/bin/pulumi
COPY --from=pulumi /pulumi/bin/*-dotnet* /pulumi/bin/
ENV PATH "/pulumi/bin:${PATH}"

CMD ["pulumi"]
