ContainerImage.PackerExtended/Dockerfile

77 lines
2.8 KiB
Docker
Raw Normal View History

2020-12-30 10:58:00 +00:00
FROM hashicorp/packer:light as packer
FROM hashicorp/terraform:light as terraform
FROM alpine:latest AS download
ENV OVFTOOL_VERSION=4.4.1-16812187
ENV OVFTOOL_INSTALLER=VMware-ovftool-${OVFTOOL_VERSION}-lin.x86_64.bundle
ENV OVFTOOL_SHA256=ecdb3dcb58494d643d35661dcda948025661ec12ce615f043e1ec5d4c85de2ce
2021-01-04 10:09:50 +00:00
ARG REPO_USERNAME
ARG REPO_PASSWORD
ADD https://${REPO_USERNAME}:${REPO_PASSWORD}@sn.itch.fyi/Repository/bin/VMware/ovftool/4.4.x/${OVFTOOL_INSTALLER} /tmp/ovftool-installer
2020-12-30 10:58:00 +00:00
RUN apk --update add --no-cache \
2021-06-17 08:59:06 +00:00
curl \
jq && \
curl -L https://api.github.com/repos/PowerShell/PowerShell/releases/latest | \
2022-04-18 10:10:14 +00:00
jq -r '.assets[] | select(.name | startswith("powershell-lts") and contains("deb_amd64")) | .browser_download_url' | \
2021-06-17 08:59:06 +00:00
xargs -I {} curl -L -o /tmp/packages-microsoft-prod.deb {}
2020-12-30 10:58:00 +00:00
FROM debian:11-slim
2020-12-30 10:58:00 +00:00
COPY --from=packer /bin/packer /bin/packer
COPY --from=terraform /bin/terraform /bin/terraform
COPY --from=download /tmp/packages-microsoft-prod.deb /tmp/packages-microsoft-prod.deb
COPY --from=download /tmp/ovftool-installer /tmp/ovftool-installer
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN dpkg -i /tmp/packages-microsoft-prod.deb || true && \
2021-06-17 09:10:16 +00:00
apt-get update && apt-get install -y --fix-broken && \
2020-12-30 10:58:00 +00:00
rm -f /tmp/packages-microsoft-prod.deb && \
apt-get upgrade -y && apt-get install -y --no-install-recommends \
# (build-essential) Dependency for installation of InSpec
2021-01-05 16:59:31 +00:00
build-essential \
2021-01-04 22:02:25 +00:00
curl \
2020-12-30 10:58:00 +00:00
git \
jq \
netcat-openbsd \
openssh-client \
2022-04-18 10:12:59 +00:00
powershell-lts \
# (python3-*) Dependency for installation of Ansible
python3-pip \
python3-setuptools \
python3-wheel \
2021-06-17 08:45:43 +00:00
# (qemu-utils) Dependency for Packer (conversion to raw disk format)
qemu-utils \
2021-06-08 14:51:38 +00:00
# (sshpass) Dependency for Packer (non-interactive password authentication)
sshpass \
2021-06-08 14:54:22 +00:00
# (xorriso) Dependency for Packer (generating isofs image)
2021-06-07 12:03:34 +00:00
xorriso \
2021-04-09 07:35:45 +00:00
yamllint && \
pip3 install --upgrade pip && \
2022-04-18 12:37:43 +00:00
pip3 install \
ansible-core \
2022-04-19 11:52:10 +00:00
# (jmespath) Dependency for Ansible 'json_query' filter
jmespath \
2022-04-18 20:14:33 +00:00
# (netaddr) Dependency for Ansible 'ipaddr' filter
netaddr \
# (pyvmomi & requests) Dependency for Ansible 'vmware_guest' module
2022-04-18 12:54:41 +00:00
pyvmomi \
2022-04-18 12:37:43 +00:00
requests && \
2020-12-30 10:58:00 +00:00
pwsh -Command "Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted' -Verbose" && \
2021-01-02 09:52:29 +00:00
pwsh -Command "Install-Module -Name 'powershell-yaml','VMware.PowerCLI' -Verbose" && \
2021-01-04 22:02:25 +00:00
pwsh -Command "Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP \$False -Confirm:\$False" && \
2020-12-30 10:58:00 +00:00
sh /tmp/ovftool-installer --console --eulas-agreed --required && \
2021-01-11 11:46:41 +00:00
apt-get remove -y \
build-essential \
curl && \
apt-get autoremove -y && \
2021-01-04 22:12:58 +00:00
rm -rf /var/lib/apt/lists/* && \
2020-12-30 10:58:00 +00:00
rm -f /tmp/ovftool-installer
ENTRYPOINT []
2022-04-18 20:14:33 +00:00
CMD []