Set up Travis CI to build example image
This commit is contained in:
parent
91ed2961c6
commit
3a558beef6
4 changed files with 69 additions and 0 deletions
27
.travis.yml
Normal file
27
.travis.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
dist: trusty
|
||||||
|
sudo: required
|
||||||
|
language: minimal
|
||||||
|
before_install:
|
||||||
|
- "wget 'https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.6.0/alpine-chroot-install' \
|
||||||
|
&& echo 'a827a4ba3d0817e7c88bae17fe34e50204983d1e alpine-chroot-install' | sha1sum -c || exit 1"
|
||||||
|
install:
|
||||||
|
- sudo sh alpine-chroot-install -b v3.6
|
||||||
|
before_script:
|
||||||
|
- sudo modprobe nbd
|
||||||
|
script:
|
||||||
|
- /alpine/enter-chroot ./alpine-make-vm-image
|
||||||
|
--image-format qcow2
|
||||||
|
--image-size 2G
|
||||||
|
--repositories-file example/repositories
|
||||||
|
--packages "$(cat example/packages)"
|
||||||
|
--script-chroot
|
||||||
|
alpine-virthardened-$(date +%Y-%m-%d).qcow2 -- ./example/configure.sh
|
||||||
|
#deploy:
|
||||||
|
# provider: releases
|
||||||
|
# api_key:
|
||||||
|
# secure: <Encrypted GitHub Personal Token>
|
||||||
|
# file: "*.qcow2"
|
||||||
|
# file_glob: true
|
||||||
|
# skip_cleanup: true
|
||||||
|
# on:
|
||||||
|
# tags: true
|
34
example/configure.sh
Executable file
34
example/configure.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
_step_counter=0
|
||||||
|
step() {
|
||||||
|
_step_counter=$(( _step_counter + 1 ))
|
||||||
|
printf '\n\033[1;36m%d) %s\033[0m\n' $_step_counter "$@" >&2 # bold cyan
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
step 'Set up timezone'
|
||||||
|
setup-timezone -z Europe/Prague
|
||||||
|
|
||||||
|
step 'Set up networking'
|
||||||
|
cat > /etc/network/interfaces <<-EOF
|
||||||
|
iface lo inet loopback
|
||||||
|
iface eth0 inet dhcp
|
||||||
|
EOF
|
||||||
|
ln -s networking /etc/init.d/net.lo
|
||||||
|
ln -s networking /etc/init.d/net.eth0
|
||||||
|
|
||||||
|
step 'Adjust rc.conf'
|
||||||
|
sed -Ei \
|
||||||
|
-e 's/^[# ](rc_depend_strict)=.*/\1=NO/' \
|
||||||
|
-e 's/^[# ](rc_logger)=.*/\1=YES/' \
|
||||||
|
-e 's/^[# ](unicode)=.*/\1=YES/' \
|
||||||
|
/etc/rc.conf
|
||||||
|
|
||||||
|
step 'Enable services'
|
||||||
|
rc-update add acpid default
|
||||||
|
rc-update add chronyd default
|
||||||
|
rc-update add crond default
|
||||||
|
rc-update add net.eth0 default
|
||||||
|
rc-update add net.lo boot
|
||||||
|
rc-update add termencoding boot
|
6
example/packages
Normal file
6
example/packages
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
chrony
|
||||||
|
less
|
||||||
|
logrotate
|
||||||
|
openssh
|
||||||
|
ssmtp
|
||||||
|
sudo
|
2
example/repositories
Normal file
2
example/repositories
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
https://nl.alpinelinux.org/alpine/v3.6/main
|
||||||
|
https://nl.alpinelinux.org/alpine/v3.6/community
|
Loading…
Reference in a new issue