Skip to content

Commit

Permalink
improve docker dev setups ; add rpi support ; the rpi stuff is compat…
Browse files Browse the repository at this point in the history
…ible with docker and podmon
  • Loading branch information
mcrosson committed May 15, 2022
1 parent 64aac2a commit 4e73a2e
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .devcontainer/Dockerfile.rpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM ubuntu:latest as base

RUN apt-get update && apt-get install -y \
git \
wget \
autoconf \
automake \
build-essential \
bzip2 \
ccache \
device-tree-compiler \
dfu-util \
g++ \
gcc \
gcc-arm-none-eabi \
libtool \
make \
ninja-build \
cmake \
python3-dev \
python3-pip \
python3-setuptools \
xz-utils \
&& rm -rf /var/lib/apt/lists/* && apt-get clean

FROM base as dev
RUN apt-get update && apt-get install -y nano vim emacs tmux htop tio minicom \
&& pip3 install --user -U west \
&& rm -rf /var/lib/apt/lists/* && apt-get clean

COPY bashrc tmp
RUN mv /tmp/bashrc ~/.bashrc

WORKDIR /workspaces

ENV ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
ENV CROSS_COMPILE=/usr/bin/arm-none-eabi-

CMD ["/bin/bash"]

1 change: 1 addition & 0 deletions .devcontainer/bashrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export LS_OPTIONS='-F --color=auto'
export PATH=~/.local/bin:${PATH}
alias ls='ls $LS_OPTIONS'
if [ "${CODESPACES}" = "true" ]; then
export WORKSPACE_DIR="$HOME/workspace/zmk"
Expand Down
11 changes: 11 additions & 0 deletions docker_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
docker run -it \
--name zmk-ardux-dev \
--network host \
--privileged \
-v /dev:/dev \
-v zmk:/workspaces/zmk \
-v ./:/workspaces/zmk-ardux \
-v ./.build:/workspaces/zmk/app/build \
zmk-ardux:latest \
/bin/bash
26 changes: 26 additions & 0 deletions docker_setup_rpi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
docker volume create zmk

cd .devcontainer

docker build --network host -t zmk-ardux:latest -f ./Dockerfile.rpi

docker run --rm \
--network host \
-v zmk:/workspaces/zmk \
zmk-ardux:latest \
/bin/bash -c "git clone https://github.com/zmkfirmware/zmk /workspaces/zmk/"

docker run \
--name zmk-ardux-setup \
--network host \
-v zmk:/workspaces/zmk \
zmk-ardux:latest \
/bin/bash -c "source ~/.bashrc && cd /workspaces/zmk && west init -l app/ && west update && west zephyr-export && pip3 install --user -r zephyr/scripts/requirements-base.txt"

docker commit zmk-ardux-setup zmk-ardux:latest

docker rm -f zmk-ardux-setup

cd ..

3 changes: 3 additions & 0 deletions docker_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker commit zmk-ardux-setup zmk-ardux:latest

0 comments on commit 4e73a2e

Please sign in to comment.