README.md 1.2 KB
Newer Older
Jan Grewe's avatar
Jan Grewe committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Packer ARM builder
This Docker image can be used to build ARM images like Raspbian with Packer.

## Usage
```
docker run --rm -v ${PWD}:/build -v ${PWD}/packer_cache:/build/packer_cache -v ${PWD}/output:/build/output -v /dev:/dev --privileged jangrewe/packer-arm:latest build my-image.json
```

- `my-image.json`:
```
{
  "variables": {
    "img_mount_path": "{{ env `PWD` }}/mnt",
  },
  "builders": [
    {
      "name": "my-image",
      "type": "arm-image",
      "iso_url": "https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip",
      "iso_checksum_type": "sha256",
      "iso_checksum": "a50237c2f718bd8d806b96df5b9d2174ce8b789eda1f03434ed2213bbca6c6ff",
      "mount_path": "{{ user `img_mount_path` }}",
      "output_directory": "output"
    }
  ],
  "provisioners": [
    {
      "type": "shell-local",
      "inline": [
        "sudo -E ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook -i '{{ user `img_mount_path` }}', -c chroot ./my-image.yml"
      ]
    }
  ]
}

```
- `my-image.yml`: a regular Ansible playbook

## Thanks
- [packer](https://packer.io)
- [packer-builder-arm-image](https://github.com/solo-io/packer-builder-arm-image/)