Added docker build environment

master
Mark 2022-12-27 13:15:52 -08:00
parent 254c0f8de0
commit 0d99adf288
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
7 changed files with 142 additions and 0 deletions

6
.gitmodules vendored
View File

@ -0,0 +1,6 @@
[submodule "docker/qmk_cli"]
path = docker/qmk_cli
url = ssh://git@git.betalupi.com:33/QMK/qmk_cli.git
[submodule "docker/qmk_firmware"]
path = docker/qmk_firmware
url = ssh://git@git.betalupi.com:33/QMK/qmk_firmware.git

15
docker/.editorconfig Normal file
View File

@ -0,0 +1,15 @@
root = false
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
[qmk_cli/*]
indent_style = space
[qmk_firmware/*]
indent_style = space

83
docker/Dockerfile Normal file
View File

@ -0,0 +1,83 @@
## Build qmk-cli
FROM python:3.8-slim-buster AS qmk_cli_builder
WORKDIR /app
COPY qmk_cli .
RUN pip3 install build
RUN python3 -m build
## Base container
FROM debian:11-slim
# Install dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
avrdude \
binutils-arm-none-eabi \
binutils-riscv64-unknown-elf \
build-essential \
ca-certificates \
clang-format-11 \
dfu-programmer \
dfu-util \
dos2unix \
ca-certificates \
gcc \
gcc-arm-none-eabi \
gcc-riscv64-unknown-elf \
git \
libfl2 \
libnewlib-arm-none-eabi \
picolibc-riscv64-unknown-elf \
python3 \
python3-pip \
software-properties-common \
tar \
teensy-loader-cli \
unzip \
tar \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*
# Install python packages
RUN python3 -m pip install --upgrade \
pip \
setuptools \
wheel \
nose2 \
yapf
# upgrade avr-gcc... for reasons?
RUN /bin/bash -c "set -o pipefail && \
wget -q https://github.com/ZakKemble/avr-gcc-build/releases/download/v8.3.0-1/avr-gcc-8.3.0-x64-linux.tar.bz2 -O - | tee /tmp/asdf.tar.bz2 | md5sum -c <(echo '588D0BEA4C5D21A1A06AA17625684417 -') && \
tar xfj /tmp/asdf.tar.bz2 --strip-components=1 -C / && \
rm -rf /share/ /tmp/*"
# Install qmk-cli
COPY --from=qmk_cli_builder /app/dist /tmp/dist
RUN python3 -m pip install /tmp/dist/qmk-*.whl && \
rm -rf /tmp/dist
# Copy qmk repo.
# Make sure you've pulled submodules first!
COPY qmk_firmware /qmk_firmware
RUN chmod -R 777 /qmk_firmware
VOLUME /qmk_firmware/keyboards
VOLUME /build_output
WORKDIR /qmk_firmware
ENV SKIP_GIT true
COPY entrypoint.sh /entrypoint.sh
CMD ["/bin/bash", "/entrypoint.sh"]
# How to use:
# docker run -it \
# --user 1000:1001 \
# -v "$(pwd)/kb:/qmk_firmware/keyboards" \
#

24
docker/README.md Normal file
View File

@ -0,0 +1,24 @@
# QMK Build Container
This container contains everything you need to build QMK, including a pinned version of QMK itself. **Be careful, this container may not use the latest version of QMK.**
## Usage
This container takes two volumes:
- `/build_output`: QMK binaries are copied here.
- `/qmk_firmware/keyboards`: QMK keyboard dir. Link this to your code.
```bash
docker run -it \
--user $(id -u):$(id -g) \
-v "$(pwd)/output:/build_output" \
-v "$(pwd)/kb:/qmk_firmware/keyboards:ro" \
-e QMK_TARGET="betalupi_ergodox:default" \
git.betalupi.com/mark/qmk
```
## Building
1. Before building, run `git submodule update --init --recursive`.
2. Checkout whatever version of `qmk_firmware` you need
3. Run `docker build . -t git.betalupi.com/mark/qmk`

12
docker/entrypoint.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [[ -z "$QMK_TARGET" ]]; then
echo "You must provide a target to build!" 1>&2
exit 1
fi
make $QMK_TARGET
# Move output files to output directory.
# These are the only extensions qmk can produce,
# as far as I know.
mv *.{bin,hex,uf2} /build_output > /dev/null 2>&1

1
docker/qmk_cli Submodule

@ -0,0 +1 @@
Subproject commit bb0094063183e31ce6a2d7a8ef73a00f67d89f1a

1
docker/qmk_firmware Submodule

@ -0,0 +1 @@
Subproject commit b56c0fa67484b965f7efdbcc46e2e7c2571e367a