piston/.github/workflows/lxc-build.yml

49 lines
1.3 KiB
YAML

---
name: LXC Build
on:
push:
workflow_dispatch:
jobs:
packer:
runs-on: ubuntu-latest
name: packer
steps:
- name: Checkout Repository
uses: actions/checkout@v2
# validate templates
- name: Validate Container
run: packer validate piston.pkr.hcl
working-directory: container
- name: Install LXC and Packer
run: |
sudo apt update
sudo apt install -y lxc lxc-templates debootstrap libvirt0 packer
echo "lxc.net.0.type = veth" > default.conf
echo "lxc.net.0.link = lxcbr0" >> default.conf
echo "lxc.net.0.flags = up" >> default.conf
sudo rm /etc/lxc/default.conf
sudo cp default.conf /etc/lxc
sudo systemctl start lxc-net
# build container
- name: Build Artifact
run: packer build -var 'make_threads=32' -var 'apt_mirror=http://azure.archive.ubuntu.com/ubuntu' piston.pkr.hcl
working-directory: container
- name: Rename config
run: mv lxc-config config
working-directory: container
# Upload container
- uses: actions/upload-artifact@v2
with:
name: lxc-container
path: |
container/output-piston-bionic/config
container/output-piston-bionic/rootfs.tar.gz