Commit 75cddbb7 authored by Jan Grewe's avatar Jan Grewe
Browse files

initial commit

parents
FROM golang:buster AS builder
RUN apt-get update -qq \
&& apt-get install -qqy git
RUN git clone --depth 1 https://github.com/solo-io/packer-builder-arm-image /build
WORKDIR /build
RUN go build
FROM debian:buster
ENV PACKER_VERSION 1.3.5
COPY --from=builder /build/packer-builder-arm-image /bin/packer-builder-arm-image
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -qqy \
qemu-user-static \
kpartx \
unzip \
sudo \
ansible \
python3-distutils \
&& rm -rf /var/lib/apt/lists/*
ADD https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip /tmp/packer.zip
RUN unzip /tmp/packer.zip -d /bin && rm /tmp/packer.zip
WORKDIR /build
ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# 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/)
#!/bin/bash
/usr/sbin/update-binfmts --enable qemu-arm >/dev/null 2>&1
/bin/packer $@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment