2021-01-28 01:19:24 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
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
|
2021-01-28 01:32:55 +01:00
|
|
|
|
2021-01-28 01:44:03 +01:00
|
|
|
- name: Install LXC and Packer
|
2021-01-28 01:32:55 +01:00
|
|
|
run: |
|
2021-01-28 01:44:03 +01:00
|
|
|
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
|
2021-01-28 01:32:55 +01:00
|
|
|
systemctl start lxc-net
|
2021-01-28 01:19:24 +01:00
|
|
|
|
|
|
|
# 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
|