Skip to content

Commit b84040a

Browse files
Merge pull request #4388 from praveenkumar/offline_images
NO-ISSUE: okd: Add step to embed all component images to final image
2 parents 2a1c5ce + fa7b1e8 commit b84040a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

okd/src/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
```bash
1313
cd ~/microshift && sudo podman build --env WITH_FLANNEL=1 -f okd/src/microshift-okd-multi-build.Containerfile . -t microshift-okd
1414
```
15+
To embed all component images
16+
```bash
17+
cd ~/microshift && sudo podman build --env EMBED_CONTAINER_IMAGES=1 -f okd/src/microshift-okd-multi-build.Containerfile . -t microshift-okd
18+
```
1519
- build runnable container based on current source:
1620
1. replace microshift assets images to OKD upstream images
1721
1. will build microshift RPMs and repo based on current sources.

okd/src/microshift-okd-multi-build.Containerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ RUN dnf install -y centos-release-nfv-openvswitch && \
4848
# once microshift is installed so better to disable it because it cause issue when required
4949
# module is not enabled.
5050
RUN ${REPO_CONFIG_SCRIPT} ${USHIFT_RPM_REPO_PATH} && \
51-
dnf install -y microshift && \
51+
dnf install -y microshift microshift-release-info && \
5252
if [ "$WITH_FLANNEL" -eq 1 ]; then \
5353
dnf install -y microshift-flannel; \
5454
systemctl disable openvswitch; \
@@ -60,6 +60,20 @@ RUN ${REPO_CONFIG_SCRIPT} ${USHIFT_RPM_REPO_PATH} && \
6060

6161
RUN ${OKD_CONFIG_SCRIPT} && rm -rf ${OKD_CONFIG_SCRIPT}
6262

63+
# If the EMBED_CONTAINER_IMAGES environment variable is set to 1:
64+
# 1. Temporarily configure user namespace UID and GID mappings by writing to /etc/subuid and /etc/subgid and clean it later
65+
# - This allows the skopeo command to operate properly which requires user namespace support.
66+
# - Without it following error occur during image build
67+
# - FATA[0129] copying system image from manifest list:[...]unpacking failed (error: exit status 1; output: potentially insufficient UIDs or GIDs available[...]
68+
# 2. Extract the list of image URLs from a JSON file (`release-$(uname -m).json`) while excluding the "lvms_operator" image.
69+
# - `lvms_operator` image is excluded because it is not available upstream
70+
RUN if [ "$EMBED_CONTAINER_IMAGES" -eq 1 ]; then \
71+
echo "root:100000:65536" > /etc/subuid; \
72+
echo "root:100000:65536" > /etc/subgid; \
73+
jq -r '.images | to_entries | map(select(.key != "lvms_operator")) | .[].value' /usr/share/microshift/release/release-$(uname -m).json | xargs -n 1 -I {} skopeo copy docker://{} containers-storage:{}; \
74+
rm -f /etc/subuid /etc/subgid; \
75+
fi
76+
6377
# Create a systemd unit to recursively make the root filesystem subtree
6478
# shared as required by OVN images
6579
COPY ./packaging/imagemode/systemd/microshift-make-rshared.service /etc/systemd/system/microshift-make-rshared.service

0 commit comments

Comments
 (0)