Added docker build environment
This commit is contained in:
		
							
								
								
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@ -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
									
								
							
							
						
						
									
										15
									
								
								docker/.editorconfig
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										83
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										24
									
								
								docker/README.md
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										12
									
								
								docker/entrypoint.sh
									
									
									
									
									
										Normal 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
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								docker/qmk_cli
									
									
									
									
									
										Submodule
									
								
							 Submodule docker/qmk_cli added at bb00940631
									
								
							
							
								
								
									
										1
									
								
								docker/qmk_firmware
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								docker/qmk_firmware
									
									
									
									
									
										Submodule
									
								
							 Submodule docker/qmk_firmware added at b56c0fa674
									
								
							
		Reference in New Issue
	
	Block a user