feat(docker): moving builder to docker
This commit is contained in:
parent
91012c2f58
commit
6da1ebf2ef
|
@ -0,0 +1,33 @@
|
|||
FROM reg.cadoles.com/proxy_cache/library/alpine:latest
|
||||
|
||||
|
||||
# Packages needed
|
||||
RUN apk update
|
||||
RUN apk add alpine-sdk build-base mtools dosfstools grub-efi apk-tools alpine-conf busybox fakeroot syslinux xorriso squashfs-tools sudo
|
||||
|
||||
# User setup
|
||||
RUN adduser build -G abuild -D
|
||||
RUN chown build:abuild /home/build -R
|
||||
|
||||
# Grant unrestricted sudo to abuild group
|
||||
RUN echo "%abuild ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/abuild
|
||||
|
||||
USER build
|
||||
WORKDIR /home/build
|
||||
RUN abuild-keygen -n -i -a
|
||||
RUN git clone --depth=1 https://gitlab.alpinelinux.org/alpine/aports.git
|
||||
|
||||
USER root
|
||||
RUN apk update
|
||||
|
||||
|
||||
COPY ./scripts/create-iso.sh /usr/bin/create-iso.sh
|
||||
RUN chmod +x /usr/bin/create-iso.sh
|
||||
|
||||
COPY ./scripts/aports/* /home/build/aports/scripts/
|
||||
RUN chmod +x /home/build/aports/scripts/*.sh
|
||||
|
||||
USER build
|
||||
WORKDIR /home/build
|
||||
CMD [ "/usr/bin/create-iso.sh", "ckubeos", "3.16"]
|
||||
|
|
@ -1,43 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
#if [[ -z $1 || -z $2 ]]; then
|
||||
if [[ -z $1 ]]; then
|
||||
echo -e "ERREUR : paramétre(s) manquant(s) "
|
||||
echo -e "Passer en paramétre : "
|
||||
echo -e "1. Nom du profil (ex : kubauto)"
|
||||
# echo -e "2. Version de l'Alpine (forcé à edge pour le moment)"
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
PROFILENAME=$1
|
||||
ALPINE_VERSION=edge
|
||||
export $PROFILENAME
|
||||
|
||||
|
||||
cat << EOF > ~/aports/scripts/mkimg.$PROFILENAME.sh
|
||||
profile_$PROFILENAME() {
|
||||
profile_standard
|
||||
kernel_cmdline="unionfs_size=512M console=tty0 console=ttyS0,115200"
|
||||
syslinux_serial="0 115200"
|
||||
apks="\$apks mtools parted rsync vim util-linux curl coreutils strace dhcp dhcpcd kubeadm lvm2 dfc cni-plugin-flannel cni-plugins
|
||||
flannel flannel-contrib-cni kubelet kubeadm kubectl uuidgen docker docker-compose
|
||||
"
|
||||
local _k _a
|
||||
for _k in \$kernel_flavors; do
|
||||
apks="\$apks linux-\$_k"
|
||||
for _a in \$kernel_addons; do
|
||||
apks="\$apks \$_a-\$_k"
|
||||
done
|
||||
done
|
||||
apks="\$apks linux-firmware"
|
||||
hostname="$PROFILENAME"
|
||||
apkovl="genapkovl-$PROFILENAME.sh"
|
||||
}
|
||||
EOF
|
||||
|
||||
chmod +x ~/aports/scripts/mkimg.$PROFILENAME.sh
|
||||
|
||||
cat << 'EOP' > ~/aports/scripts/genapkovl-$PROFILENAME.sh
|
||||
#!/bin/sh -e
|
||||
|
||||
HOSTNAME="$1"
|
||||
|
@ -84,9 +44,11 @@ EOF
|
|||
mkdir -p "$tmp/root/.ssh"
|
||||
mkdir -p "$tmp/etc/apk"
|
||||
echo '/media/cdrom' >> "$tmp/etc/apk/repositories"
|
||||
echo 'http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main' >> "$tmp/etc/apk/repositories"
|
||||
echo 'http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community' >> "$tmp/etc/apk/repositories"
|
||||
echo 'http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/testing' >> "$tmp/etc/apk/repositories"
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main" >> "$tmp/etc/apk/repositories"
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community" >> "$tmp/etc/apk/repositories"
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> "$tmp/etc/apk/repositories"
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> "$tmp/etc/apk/repositories"
|
||||
|
||||
|
||||
mkdir -p "$tmp"/etc/apk
|
||||
makefile root:root 0644 "$tmp"/etc/apk/world <<EOF
|
||||
|
@ -104,7 +66,9 @@ kubeadm
|
|||
kubectl
|
||||
uuidgen
|
||||
docker
|
||||
docker-compose
|
||||
mtools
|
||||
dosfstools
|
||||
grub-efi
|
||||
EOF
|
||||
|
||||
mkdir -p "$tmp"/etc/local.d
|
||||
|
@ -145,24 +109,4 @@ rc_add mount-ro shutdown
|
|||
rc_add killprocs shutdown
|
||||
rc_add savecache shutdown
|
||||
|
||||
tar -c -C "$tmp" etc | gzip -9n > $HOSTNAME.apkovl.tar.gz
|
||||
EOP
|
||||
chmod +x ~/aports/scripts/genapkovl-$PROFILENAME.sh
|
||||
|
||||
# Create output dir
|
||||
if test ! -d ~/iso; then
|
||||
echo "Creating output dir"
|
||||
mkdir -p ~/iso
|
||||
fi
|
||||
|
||||
echo "ISO generation"
|
||||
cd ~/aports/scripts/
|
||||
sh mkimage.sh --tag $ALPINE_VERSION \
|
||||
--outdir ~/iso \
|
||||
--arch x86_64 \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/testing \
|
||||
--profile $PROFILENAME
|
||||
|
||||
fi
|
||||
tar -c -C "$tmp" etc | gzip -9n > $HOSTNAME.apkovl.tar.gz
|
|
@ -0,0 +1,17 @@
|
|||
profile_ckubeos() {
|
||||
profile_standard
|
||||
kernel_cmdline="unionfs_size=512M console=tty0 console=ttyS0,115200"
|
||||
syslinux_serial="0 115200"
|
||||
apks="$apks mtools parted rsync mtools dosfstools grub-efi vim util-linux curl coreutils strace dhcp dhcpcd kubeadm lvm2 dfc cni-plugin-flannel cni-plugins
|
||||
flannel flannel-contrib-cni kubelet kubeadm kubectl uuidgen docker"
|
||||
local _k _a
|
||||
for _k in $kernel_flavors; do
|
||||
apks="$apks linux-$_k"
|
||||
for _a in $kernel_addons; do
|
||||
apks="$apks $_a-$_k"
|
||||
done
|
||||
done
|
||||
apks="$apks linux-firmware"
|
||||
hostname="ckubeos"
|
||||
apkovl="genapkovl-ckubeos.sh"
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
#if [[ -z $1 || -z $2 ]]; then
|
||||
if [[ -z $1 ]]; then
|
||||
echo -e "ERREUR : paramétre(s) manquant(s) "
|
||||
echo -e "Passer en paramétre : "
|
||||
echo -e "1. Nom du profil (ex : ckubeos)"
|
||||
# echo -e "2. Version de l'Alpine (forcé à edge pour le moment)"
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
PROFILENAME=$1
|
||||
ALPINE_VERSION=$2
|
||||
|
||||
# Create output dir
|
||||
if test ! -d ~/iso; then
|
||||
echo "Creating output dir"
|
||||
mkdir -p ~/iso
|
||||
fi
|
||||
|
||||
echo "ISO generation"
|
||||
cd ~/aports/scripts/
|
||||
sh mkimage.sh --tag $ALPINE_VERSION \
|
||||
--outdir /home/build/iso \
|
||||
--arch x86_64 \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
|
||||
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||
--profile $PROFILENAME
|
||||
fi
|
Loading…
Reference in New Issue