-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathalpine.sh
More file actions
77 lines (73 loc) · 3.53 KB
/
alpine.sh
File metadata and controls
77 lines (73 loc) · 3.53 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
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
#
##DO NOT RUN DIRECTLY
##Self: bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/bootstrap/alpine.sh")
#-------------------------------------------------------#
#-------------------------------------------------------#
set -x
#-------------------------------------------------------#
#-------------------------------------------------------#
##Bootstrap
pushd "$(mktemp -d)" >/dev/null 2>&1
docker stop "alpine-base" 2>/dev/null ; docker rm "alpine-base" 2>/dev/null
docker run --name "alpine-base" --privileged "alpine:edge" sh -l -c '
#Bootstrap
apk update --no-interactive
apk upgrade --no-interactive
apk add bash binutils curl fakeroot gawk musl-locales-lang sed wget --latest --upgrade --no-interactive
#apk add bash alsa-utils alsa-utils-doc alsa-lib alsaconf alsa-ucm-conf pulseaudio pulseaudio-alsa --latest --upgrade --no-interactive
#Fix & Patches
chmod 755 "/bin/bbsuid" 2>/dev/null
echo -e "nameserver 8.8.8.8\nnameserver 2620:0:ccc::2" | tee "/etc/resolv.conf"
echo -e "nameserver 1.1.1.1\nnameserver 2606:4700:4700::1111" | tee -a "/etc/resolv.conf"
mkdir -pv "/etc/apk"
echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee "/etc/apk/repositories"
echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a "/etc/apk/repositories"
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a "/etc/apk/repositories"
echo "LANG=en_US.UTF-8" | tee "/etc/locale.conf"
echo "LANG=en_US.UTF-8" | tee -a "/etc/locale.conf"
echo "LANGUAGE=en_US:en" | tee -a "/etc/locale.conf"
echo "LC_ALL=en_US.UTF-8" | tee -a "/etc/locale.conf"
locale-gen
locale-gen "en_US.UTF-8"
#Cleanup
bash -c "rm -rfv /{tmp,proc,sys,dev,run}"
bash -c "mkdir -pv /{tmp,proc,sys,dev,run/media,mnt,media,home}"
bash -c "rm -fv /etc/{host.conf,hosts,passwd,group,nsswitch.conf}"
bash -c "touch /etc/{host.conf,hosts,passwd,group,nsswitch.conf}"
apk info -L
rm -rfv "/var/cache/apk/"*
'
##Export
docker export "$(docker ps -aqf 'name=alpine-base')" --output "rootfs.tar"
if [[ -f "./rootfs.tar" ]] && [[ $(stat -c%s "./rootfs.tar") -gt 10000 ]]; then
rsync -achLv --mkpath "./rootfs.tar" "/tmp/rootfs.tar"
else
echo "\n[-] FATAL: Failed to export ROOTFS\n"
exit 1
fi
popd "$(mktemp -d)" >/dev/null 2>&1
#-------------------------------------------------------#
#-------------------------------------------------------#
##Push
#ENV
D_ID="$(docker ps -aqf 'name=alpine-base' | tr -d '[:space:]')"
D_TAG="v$(date +'%Y.%m.%d' | tr -d '[:space:]')"
export D_ID D_TAG
#Export & Import
docker export "${D_ID}" | docker import - "pkgforge/alpine-base:temp"
#Tags
docker tag "pkgforge/alpine-base:temp" "pkgforge/alpine-base:latest"
docker tag "pkgforge/alpine-base:temp" "ghcr.io/pkgforge/devscripts/alpine-base:latest"
docker tag "pkgforge/alpine-base:temp" "pkgforge/alpine-base:${D_TAG}"
docker tag "pkgforge/alpine-base:temp" "ghcr.io/pkgforge/devscripts/alpine-base:${D_TAG}"
docker tag "pkgforge/alpine-base:temp" "pkgforge/alpine-base:$(uname -m)"
docker tag "pkgforge/alpine-base:temp" "ghcr.io/pkgforge/devscripts/alpine-base:$(uname -m)"
#Push
docker push "pkgforge/alpine-base:latest"
docker push "ghcr.io/pkgforge/devscripts/alpine-base:latest"
docker push "pkgforge/alpine-base:${D_TAG}"
docker push "ghcr.io/pkgforge/devscripts/alpine-base:${D_TAG}"
docker push "pkgforge/alpine-base:$(uname -m)"
docker push "ghcr.io/pkgforge/devscripts/alpine-base:$(uname -m)"
#-------------------------------------------------------#