Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
20f39db7
Unverified
Commit
20f39db7
authored
Feb 21, 2016
by
Jakub Jirutka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-alpine: cache APK packages instead of rootfs
Signed-off-by:
Jakub Jirutka
<
jakub@jirutka.cz
>
parent
5845ac2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
29 deletions
+15
-29
lxc-alpine.in
templates/lxc-alpine.in
+15
-29
No files found.
templates/lxc-alpine.in
View file @
20f39db7
...
@@ -85,7 +85,8 @@ usage() {
...
@@ -85,7 +85,8 @@ usage() {
APK_KEYS_DIR Path to directory with GPG keys for APK. If not set and
APK_KEYS_DIR Path to directory with GPG keys for APK. If not set and
/etc/apk/keys does not contain alpine keys, then the script
/etc/apk/keys does not contain alpine keys, then the script
will download the keys from
${
APK_KEYS_URI
}
.
will download the keys from
${
APK_KEYS_URI
}
.
LXC_CACHE_PATH Path to the cache directory where to store cached rootfs.
LXC_CACHE_PATH Path to the cache directory where to store bootstrap files
and APK packages.
EOF
EOF
}
}
...
@@ -226,36 +227,23 @@ fetch_apk_static() {
...
@@ -226,36 +227,23 @@ fetch_apk_static() {
#============================ Install ============================#
#============================ Install ============================#
install
()
{
install
()
{
local
rootfs
=
"
$1
"
local arch
=
"
$2
"
local
branch
=
"
$3
"
local
cache_dir
=
"
$LXC_CACHE_DIR
/rootfs-
$branch
-
$arch
"
if
[
"
$FLUSH_CACHE
"
=
'yes'
]
&&
[
-d
"
$cache_dir
"
]
;
then
einfo
"Cleaning cached rootfs of Alpine
$branch
$arch
"
rm
-Rf
"
$cache_dir
"
fi
if
[
!
-d
"
$cache_dir
/rootfs"
]
;
then
einfo
"Building Alpine rootfs in
$cache_dir
/rootfs"
build_alpine
"
$cache_dir
/rootfs"
"
$arch
"
"
$branch
"
fi
einfo
"Copying cached rootfs to
$rootfs
"
mkdir
-p
"
$rootfs
"
cp
-a
"
$cache_dir
"
/rootfs/
*
"
$rootfs
"
/
}
build_alpine
()
{
local
dest
=
"
$1
"
local
dest
=
"
$1
"
local arch
=
"
$2
"
local arch
=
"
$2
"
local
branch
=
"
$3
"
local
branch
=
"
$3
"
local
apk_cache
=
"
$LXC_CACHE_DIR
/apk/
$arch
"
local
repo_url
=
"
$MIRROR_URL
/
$branch
/main"
local
repo_url
=
"
$MIRROR_URL
/
$branch
/main"
rm
-Rf
"
$dest
.part"
2>/dev/null
if
[
"
$FLUSH_CACHE
"
=
'yes'
]
&&
[
-d
"
$apk_cache
"
]
;
then
mkdir
-p
"
$dest
.part"
einfo
"Cleaning cached APK packages for
$arch
"
rm
-Rf
"
$apk_cache
"
fi
mkdir
-p
"
$apk_cache
"
einfo
"Installing Alpine Linux in
$dest
"
cd
"
$dest
"
cd
"
$dest
.part"
mkdir
-p
etc/apk
ln
-s
"
$apk_cache
"
etc/apk/cache
$APK
--update-cache
--initdb
--arch
=
"
$arch
"
\
$APK
--update-cache
--initdb
--arch
=
"
$arch
"
\
--root
=
.
--keys-dir
=
"
$APK_KEYS_DIR
"
--repository
=
"
$repo_url
"
\
--root
=
.
--keys-dir
=
"
$APK_KEYS_DIR
"
--repository
=
"
$repo_url
"
\
...
@@ -272,10 +260,8 @@ build_alpine() {
...
@@ -272,10 +260,8 @@ build_alpine() {
chroot
.
/bin/true
\
chroot
.
/bin/true
\
||
die 3
'Failed to execute /bin/true in chroot, the builded rootfs is broken!'
||
die 3
'Failed to execute /bin/true in chroot, the builded rootfs is broken!'
rm
etc/apk/cache
cd
-
>
/dev/null
cd
-
>
/dev/null
rm
-Rf
"
$dest
"
mv
"
$dest
.part"
"
$dest
"
}
}
make_dev_nodes
()
{
make_dev_nodes
()
{
...
@@ -496,7 +482,7 @@ fi
...
@@ -496,7 +482,7 @@ fi
# Here we go!
# Here we go!
run_exclusively
'bootstrap'
10 bootstrap
run_exclusively
'bootstrap'
10 bootstrap
run_exclusively
"
$
release
-
$
arch
"
30
install
"
$rootfs
"
"
$arch
"
"
$release
"
run_exclusively
"
$arch
"
30
install
"
$rootfs
"
"
$arch
"
"
$release
"
configure_container
"
$path
/config"
"
$name
"
"
$arch
"
configure_container
"
$path
/config"
"
$name
"
"
$arch
"
einfo
"Container's rootfs and config have been created"
einfo
"Container's rootfs and config have been created"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment