ContainerImage.PackerExtended/Dockerfile

88 lines
3.2 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
2023-03-15 10:53:25 +00:00
RUN apk --update add --no-cache \
curl \
jq && \
curl -L https://api.github.com/repos/mikefarah/yq/releases/latest | \
2023-03-16 11:37:47 +00:00
jq -r '.assets[] | select(.name | endswith("yq_linux_amd64")) | .browser_download_url' | \
xargs -I {} curl -L -o /tmp/yq {} && \
chmod +x /tmp/yq
2023-03-15 10:53:25 +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/ovftool-installer /tmp/ovftool-installer
2023-03-15 10:53:25 +00:00
COPY --from=download /tmp/yq /bin/yq
2020-12-30 10:58:00 +00:00
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
2023-01-03 08:17:41 +00:00
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
2023-01-03 08:21:57 +00:00
ca-certificates \
2023-01-03 08:17:41 +00:00
curl \
gnupg && \
2023-01-03 09:14:50 +00:00
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list && \
2023-01-03 08:34:13 +00:00
apt-get update && 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 \
2020-12-30 10:58:00 +00:00
git \
jq \
2022-04-19 14:06:01 +00:00
locales \
2023-03-04 12:07:42 +00:00
make \
2020-12-30 10:58:00 +00:00
netcat-openbsd \
openssh-client \
2023-01-03 08:25:35 +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 && \
2022-04-19 14:06:01 +00:00
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen && \
pip3 install --upgrade pip && \
2022-04-18 12:37:43 +00:00
pip3 install \
ansible-core~=2.14.0 \
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 && \
2023-01-03 10:44:08 +00:00
update-ca-certificates --fresh && \
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 \
2023-01-03 08:17:41 +00:00
apt-transport-https \
2021-01-11 11:46:41 +00:00
build-essential \
2023-01-03 10:44:08 +00:00
# ca-certificates \
2023-01-03 08:17:41 +00:00
gnupg && \
2021-01-11 11:46:41 +00:00
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 []