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

51 lines
1.4 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: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update -y
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
systemctl start lxc-net
# build container
- name: Build Artifact
run: packer build -var 'make_threads=32' 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