mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #18937 from cbalducci/patch-1
[mkimage-alpine.sh] Additional repo and container cleanup
This commit is contained in:
commit
8b68853ef5
1 changed files with 13 additions and 8 deletions
|
@ -8,7 +8,7 @@ set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf >&2 '%s: [-r release] [-m mirror] [-s]\n' "$0"
|
printf >&2 '%s: [-r release] [-m mirror] [-s] [-c additional repository]\n' "$0"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,22 +19,23 @@ tmp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
apkv() {
|
apkv() {
|
||||||
curl -sSL $REPO/$ARCH/APKINDEX.tar.gz | tar -Oxz |
|
curl -sSL $MAINREPO/$ARCH/APKINDEX.tar.gz | tar -Oxz |
|
||||||
grep '^P:apk-tools-static$' -A1 | tail -n1 | cut -d: -f2
|
grep --text '^P:apk-tools-static$' -A1 | tail -n1 | cut -d: -f2
|
||||||
}
|
}
|
||||||
|
|
||||||
getapk() {
|
getapk() {
|
||||||
curl -sSL $REPO/$ARCH/apk-tools-static-$(apkv).apk |
|
curl -sSL $MAINREPO/$ARCH/apk-tools-static-$(apkv).apk |
|
||||||
tar -xz -C $TMP sbin/apk.static
|
tar -xz -C $TMP sbin/apk.static
|
||||||
}
|
}
|
||||||
|
|
||||||
mkbase() {
|
mkbase() {
|
||||||
$TMP/sbin/apk.static --repository $REPO --update-cache --allow-untrusted \
|
$TMP/sbin/apk.static --repository $MAINREPO --update-cache --allow-untrusted \
|
||||||
--root $ROOTFS --initdb add alpine-base
|
--root $ROOTFS --initdb add alpine-base
|
||||||
}
|
}
|
||||||
|
|
||||||
conf() {
|
conf() {
|
||||||
printf '%s\n' $REPO > $ROOTFS/etc/apk/repositories
|
printf '%s\n' $MAINREPO > $ROOTFS/etc/apk/repositories
|
||||||
|
printf '%s\n' $ADDITIONALREPO >> $ROOTFS/etc/apk/repositories
|
||||||
}
|
}
|
||||||
|
|
||||||
pack() {
|
pack() {
|
||||||
|
@ -42,7 +43,7 @@ pack() {
|
||||||
id=$(tar --numeric-owner -C $ROOTFS -c . | docker import - alpine:$REL)
|
id=$(tar --numeric-owner -C $ROOTFS -c . | docker import - alpine:$REL)
|
||||||
|
|
||||||
docker tag $id alpine:latest
|
docker tag $id alpine:latest
|
||||||
docker run -i -t alpine printf 'alpine:%s with id=%s created!\n' $REL $id
|
docker run -i -t --rm alpine printf 'alpine:%s with id=%s created!\n' $REL $id
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
@ -62,6 +63,9 @@ while getopts "hr:m:s" opt; do
|
||||||
s)
|
s)
|
||||||
SAVE=1
|
SAVE=1
|
||||||
;;
|
;;
|
||||||
|
c)
|
||||||
|
ADDITIONALREPO=community
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
@ -71,7 +75,8 @@ done
|
||||||
REL=${REL:-edge}
|
REL=${REL:-edge}
|
||||||
MIRROR=${MIRROR:-http://nl.alpinelinux.org/alpine}
|
MIRROR=${MIRROR:-http://nl.alpinelinux.org/alpine}
|
||||||
SAVE=${SAVE:-0}
|
SAVE=${SAVE:-0}
|
||||||
REPO=$MIRROR/$REL/main
|
MAINREPO=$MIRROR/$REL/main
|
||||||
|
ADDITIONALREPO=$MIRROR/$REL/community
|
||||||
ARCH=${ARCH:-$(uname -m)}
|
ARCH=${ARCH:-$(uname -m)}
|
||||||
|
|
||||||
tmp
|
tmp
|
||||||
|
|
Loading…
Add table
Reference in a new issue