Skip to content

Commit

Permalink
Merge pull request #1204 from tu1h/multiarch_ospkg_ubuntu
Browse files Browse the repository at this point in the history
Support multi-arch for Ubuntu ospkg
  • Loading branch information
ErikJiang authored Apr 15, 2024
2 parents 69b15bd + 120c58f commit a3dc446
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 37 deletions.
25 changes: 14 additions & 11 deletions artifacts/import_iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,23 @@ function iso::import_data() {
path_list+=("${iso_mnt_path}/minimal")
fi

if [ "${#path_list[@]}" -gt 0 ]; then
for path_name in "${path_list[@]}"; do
if [ "${is_cp_path}" == "true" ]; then
mkdir -p "${target_path}/${minio_server_path}"
cp -vr "${path_name}" "${target_path}/${minio_server_path}"
else
## "/mnt/kubean-temp-iso/Pkgs" => "kubeaniominioserver/kubean/centos-dvd/7/os/x86_64/"
mc cp --no-color --recursive "${path_name}" "${minio_files_path}"
fi
done
else
if [ "${#path_list[@]}" -le 0 ]; then
echo "cannot find valid repo data from ${iso_file_path}"
exit 1
fi

for path_name in "${path_list[@]}"; do
if [ "${is_cp_path}" == "true" ]; then
mkdir -p "${target_path}/${minio_server_path}"
cp -vr "${path_name}" "${target_path}/${minio_server_path}"
else
## "/mnt/kubean-temp-iso/Pkgs" => "kubeaniominioserver/kubean/centos-dvd/7/os/x86_64/"
mc cp --no-color --recursive "${path_name}" "${minio_files_path}"
if [ "${path_name}" == "${iso_mnt_path}/dists" ]; then
mc rm --no-color ${minio_files_path}/dists/$(dir --hide=*stable ${path_name})/Release ${minio_files_path}/dists/$(dir --hide=*stable ${path_name})/Release.gpg
fi
fi
done
}

function iso::import_main() {
Expand Down
28 changes: 15 additions & 13 deletions build/os-packages/Dockerfile.ubuntu1804
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ RUN rm /bin/sh && ln -s /bin/bash /bin/sh \
&& echo "deb [arch=$ARCH] https://download.docker.com/linux/ubuntu ${OS_VERSION} stable" > /etc/apt/sources.list.d/docker.list\
&& apt update -qq

WORKDIR /ubuntu/${TARGETARCH}
COPY build/os-packages/packages.yml .
WORKDIR /ubuntu
ARG PACKAGES_PREFIX=dists/${OS_VERSION}/main/binary-${TARGETARCH}

COPY build/os-packages/packages.yml ./${PACKAGES_PREFIX}/packages.yml

COPY --from=mikefarah/yq:4.30.8 /usr/bin/yq /usr/bin/yq
# The version of docker-ce-cli should be consistent with that of docker-ce.
# See https://github.com/kubean-io/kubean/issues/1156
RUN yq eval '.common[],.apt[],.ubuntu1804[]' packages.yml > packages.list \
&& while read -r line; do \
if [[ $line == docker-ce* ]]; then \
version=$(echo $line | cut -d'=' -f2); \
line="$line docker-ce-cli=$version"; \
fi; \
apt-get install --reinstall --print-uris $line | egrep "https|http" | awk -F "'" '{print $2}' >> urls.list; \
done <<<"$(sort -u packages.list)"
RUN while read -r line; do \
if [[ $line == docker-ce* ]]; then \
version=$(echo $line | cut -d'=' -f2); \
line="$line docker-ce-cli=$version"; \
fi; \
apt-get install --reinstall --print-uris $line | egrep "https|http" | awk -F "'" '{print $2}' >> urls.list; \
done <<<"$(yq eval '.common[],.apt[],.ubuntu1804[]' ./${PACKAGES_PREFIX}/packages.yml | sort -u)" \
&& sort -u urls.list > ./${PACKAGES_PREFIX}/packages.list \
&& rm -f urls.list

RUN cat urls.list | sort | uniq > packages.list \
&& wget -q -x -P ${OS_VERSION} -i packages.list \
&& dpkg-scanpackages ${OS_VERSION} | gzip -9c > ${OS_VERSION}/Packages.gz
RUN wget -q -x -P ${PACKAGES_PREFIX} -i ./${PACKAGES_PREFIX}/packages.list \
&& dpkg-scanpackages --multiversion ${PACKAGES_PREFIX} | gzip -9c > ${PACKAGES_PREFIX}/Packages.gz

FROM scratch
COPY --from=os-bionic /ubuntu /resources/ubuntu
28 changes: 15 additions & 13 deletions build/os-packages/Dockerfile.ubuntu2004
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ RUN rm /bin/sh && ln -s /bin/bash /bin/sh \
&& echo "deb [arch=$ARCH] https://download.docker.com/linux/ubuntu ${OS_VERSION} stable" > /etc/apt/sources.list.d/docker.list\
&& apt update -qq

WORKDIR /ubuntu/${TARGETARCH}
COPY build/os-packages/packages.yml .
WORKDIR /ubuntu
ARG PACKAGES_PREFIX=dists/${OS_VERSION}/main/binary-${TARGETARCH}

COPY build/os-packages/packages.yml ./${PACKAGES_PREFIX}/packages.yml

COPY --from=mikefarah/yq:4.30.8 /usr/bin/yq /usr/bin/yq
# The version of docker-ce-cli should be consistent with that of docker-ce.
# See https://github.com/kubean-io/kubean/issues/1156
RUN yq eval '.common[],.apt[],.ubuntu2004[]' packages.yml > packages.list \
&& while read -r line; do \
if [[ $line == docker-ce* ]]; then \
version=$(echo $line | cut -d'=' -f2); \
line="$line docker-ce-cli=$version containerd.io=1.6.28-1"; \
fi; \
apt-get install --reinstall --print-uris $line | egrep "https|http" | awk -F "'" '{print $2}' >> urls.list; \
done <<<"$(sort -u packages.list)"
RUN while read -r line; do \
if [[ $line == docker-ce* ]]; then \
version=$(echo $line | cut -d'=' -f2); \
line="$line docker-ce-cli=$version containerd.io=1.6.28-1"; \
fi; \
apt-get install --reinstall --print-uris $line | egrep "https|http" | awk -F "'" '{print $2}' >> urls.list; \
done <<<"$(yq eval '.common[],.apt[],.ubuntu2004[]' ./${PACKAGES_PREFIX}/packages.yml | sort -u)" \
&& sort -u urls.list > ./${PACKAGES_PREFIX}/packages.list \
&& rm -f urls.list

RUN cat urls.list | sort | uniq > packages.list \
&& wget -q -x -P ${OS_VERSION} -i packages.list \
&& dpkg-scanpackages ${OS_VERSION} | gzip -9c > ${OS_VERSION}/Packages.gz
RUN wget -q -x -P ${PACKAGES_PREFIX} -i ./${PACKAGES_PREFIX}/packages.list \
&& dpkg-scanpackages --multiversion ${PACKAGES_PREFIX} | gzip -9c > ${PACKAGES_PREFIX}/Packages.gz

FROM scratch
COPY --from=os-focal /ubuntu /resources/ubuntu

0 comments on commit a3dc446

Please sign in to comment.