-
Notifications
You must be signed in to change notification settings - Fork 12
/
launch-build-env.sh
executable file
·23 lines (19 loc) · 1.1 KB
/
launch-build-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
CONTAINER_NAME=lxd-webui
lxc info lxd-webui &> /dev/null || {
lxc launch images:ubuntu/xenial/amd64 ${CONTAINER_NAME} -c security.privileged=true
lxc config device add ${CONTAINER_NAME} lxd-webui disk source=$PWD path=/home/ubuntu/lxd-webui
sleep 5 # Wait network DHCP
lxc exec ${CONTAINER_NAME} -- apt-get update
lxc exec ${CONTAINER_NAME} -- apt-get install -y apt-transport-https curl
lxc exec ${CONTAINER_NAME} -- bash << EOF
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
echo 'deb https://deb.nodesource.com/node_4.x trusty main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src https://deb.nodesource.com/node_4.x trusty main' >> /etc/apt/sources.list.d/nodesource.list
EOF
lxc exec ${CONTAINER_NAME} -- apt-get update
lxc exec ${CONTAINER_NAME} -- apt-get install -y nodejs git graphicsmagick imagemagick icnsutils ruby-dev build-essential
lxc exec ${CONTAINER_NAME} -- gem install fpm
}
lxc list lxd-webui -c s | grep STOPPED &> /dev/null && lxc start lxd-webui
lxc exec ${CONTAINER_NAME} -- sudo -u ubuntu -i