2018-04-30 23:13:11 +02:00
|
|
|
#!/bin/sh
|
2018-07-15 21:55:35 +02:00
|
|
|
set -e
|
2018-04-30 23:13:11 +02:00
|
|
|
|
|
|
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic-runtimes
|
|
|
|
|
2018-09-04 21:42:26 +02:00
|
|
|
# Build basic Alpine image
|
2018-09-04 22:45:52 +02:00
|
|
|
mkdir -p /var/lib/lxc/build
|
|
|
|
mkdir -p /var/lib/lxc/shared/alpine
|
|
|
|
wget https://github.com/gliderlabs/docker-alpine/raw/2bfe6510ee31d86cfeb2f37587f4cf866f28ffbc/versions/library-3.8/x86_64/rootfs.tar.xz -O - | tar xJf - -C /var/lib/lxc/shared/alpine
|
|
|
|
touch /var/lib/lxc/shared/alpine/etc/resolv.conf
|
2018-09-04 22:13:08 +02:00
|
|
|
cp ${SOURCE_DIR}/var/lib/lxc/build/config /var/lib/lxc/build/config
|
|
|
|
lxc-execute -n build -- /bin/sh -c 'apk --no-cache add s6'
|
2018-09-04 21:42:26 +02:00
|
|
|
|
2018-09-04 22:45:52 +02:00
|
|
|
# Build Java overlay
|
|
|
|
mkdir /var/lib/lxc/shared/java
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/java|' /var/lib/lxc/build/config
|
|
|
|
lxc-execute -n build -- /bin/sh -c 'apk --no-cache add openjdk8-jre-base'
|
|
|
|
|
|
|
|
# Build PHP overlay
|
|
|
|
mkdir /var/lib/lxc/shared/php
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/php|' /var/lib/lxc/build/config
|
|
|
|
lxc-execute -n build -- /bin/sh -c 'apk --no-cache add nginx php7 php7-ctype php7-fpm php7-gd php7-json php7-mbstring php7-mcrypt php7-opcache php7-session'
|
|
|
|
|
|
|
|
# Build libxml overlay
|
|
|
|
mkdir /var/lib/lxc/shared/libxml
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/libxml|' /var/lib/lxc/build/config
|
|
|
|
lxc-execute -n build -- /bin/sh -c 'apk --no-cache add libxml2 libxslt'
|
|
|
|
|
|
|
|
# Build Python2 overlay
|
|
|
|
mkdir /var/lib/lxc/shared/python2
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/libxml:/var/lib/lxc/shared/python2|' /var/lib/lxc/build/config
|
|
|
|
lxc-execute -n build -- /bin/sh -c 'apk --no-cache add python2'
|
|
|
|
|
|
|
|
# Build Python3 overlay
|
|
|
|
mkdir /var/lib/lxc/shared/python3
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/libxml:/var/lib/lxc/shared/python3|' /var/lib/lxc/build/config
|
|
|
|
lxc-execute -n build -- /bin/sh -c 'apk --no-cache add python3 && ln -s /usr/bin/python3 /usr/bin/python'
|
|
|
|
|
|
|
|
# Build Ruby overlay
|
|
|
|
mkdir /var/lib/lxc/shared/ruby
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/ruby|' /var/lib/lxc/build/config
|
|
|
|
cp -p ${SOURCE_DIR}/ruby.sh /var/lib/lxc/shared/ruby/ruby.sh
|
|
|
|
lxc-execute -n build -- /ruby.sh
|
|
|
|
rm /var/lib/lxc/shared/ruby/ruby.sh
|
|
|
|
|
|
|
|
# Build Tomcat overlay
|
|
|
|
mkdir /var/lib/lxc/shared/tomcat
|
|
|
|
sed -i 's|^lxc\.rootfs\.path.*|lxc.rootfs.path = overlay:/var/lib/lxc/shared/alpine:/var/lib/lxc/shared/java:/var/lib/lxc/shared/tomcat|' /var/lib/lxc/build/config
|
|
|
|
cp -p ${SOURCE_DIR}/tomcat.sh /var/lib/lxc/shared/tomcat/tomcat.sh
|
|
|
|
lxc-execute -n build -- /tomcat.sh
|
|
|
|
rm /var/lib/lxc/shared/tomcat/ruby.sh
|
|
|
|
cp -rp ${SOURCE_DIR}/tomcat/ /var/lib/lxc/shared/tomcat/
|