-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (47 loc) · 2.06 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (47 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# © Broadcom. All Rights Reserved.
# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
# SPDX-License-Identifier: MPL-2.0
ARG BASE_IMAGE=library/photon:5.0
FROM ${BASE_IMAGE}
ARG IMAGE_BUILDER_COMMIT_ID=""
ARG ANSIBLE_VERSION=2.15.13
ARG IMAGE_BUILDER_REPO="https://github.com/kubernetes-sigs/image-builder.git"
ARG IMAGE_BUILDER_REPO_NAME=image-builder
ARG PACKER_GITHUB_API_TOKEN=""
# Set PIP_INDEX_URL default value to public PyPI URL.
ARG PIP_INDEX_URL=https://pypi.org/simple
ARG WINDOWS_ADMIN_PASSWORD
ENV WINDOWS_ADMIN_PASSWORD="${WINDOWS_ADMIN_PASSWORD}"
ENV PATH=${PATH}:/ovftool
ENV LANG=en_US.UTF-8
SHELL ["/bin/bash", "-c"]
RUN tdnf -y update --refresh
RUN tdnf -y install python3-3.11.15-1.1.ph5 python3-pip-24.3.1-5.ph5 --enablerepo=photon --disablerepo=photon-updates
# Install required packages
RUN for package in openssh-clients unzip git wget build-essential jq coreutils xorriso grep ; do tdnf -y install "$package" --refresh; done
# Install Semver, jinja, and Windows Remote Management
RUN pip3 install --index-url "${PIP_INDEX_URL}" semver jinja2 jinja2-time pywinrm
# Setup image Builder code
RUN git clone $IMAGE_BUILDER_REPO $IMAGE_BUILDER_REPO_NAME
WORKDIR $IMAGE_BUILDER_REPO_NAME
RUN git checkout $IMAGE_BUILDER_COMMIT_ID
# Install Ansible
RUN pip3 install --index-url "${PIP_INDEX_URL}" "ansible-core==${ANSIBLE_VERSION}"
# Set the environment variable where packer will be installed
ENV PATH=${PATH}:/image-builder/images/capi/.local/bin
# Running deps-ova to setup packer, goss provisioner and other ansible galaxy collections
WORKDIR images/capi
# This version of ansible requires locale to be set explicitly.
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# Fix the packer plugin installation failure
RUN sed -i 's|github.com/hashicorp/vsphere|github.com/vmware/vsphere|' packer/ova/config.pkr.hcl
RUN make deps-ova
# Make sure packer and ansible are installed properly
RUN command -v packer
RUN command -v ansible
COPY patches patches
# Copy the image build script
COPY build-ova.sh .
RUN chmod +x build-ova.sh
CMD ["./build-ova.sh"]