Author: Adam Evyčędo <git@apiote.xyz>
add zmk config
zmk-config/Dockerfile | 23 +++++++++++++++++++++++ zmk-config/build.sh | 16 ++++++++++++++++
diff --git a/zmk-config/Dockerfile b/zmk-config/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..024444e9a397f153daaa843cc8641e86b5054bd0 --- /dev/null +++ b/zmk-config/Dockerfile @@ -0,0 +1,23 @@ +FROM zmkfirmware/zmk-build-arm:stable +RUN apt update; apt upgrade -y +RUN apt install -y python3-pip +RUN useradd -m zmk && echo "zmk:zmk" | chpasswd +USER zmk +WORKDIR /home/zmk/ +RUN mkdir .ssh +COPY ssh_key .ssh/id_ed25519 +COPY known_hosts .ssh/known_hosts +RUN pip3 install --user -U west +RUN git clone https://github.com/zmkfirmware/zmk.git +WORKDIR zmk +RUN west init -l app/ +RUN west update +RUN west zephyr-export +RUN pip3 install --user -r zephyr/scripts/requirements.txt +WORKDIR app +COPY build.sh build.sh +USER root +RUN chown zmk:zmk build.sh +USER zmk +RUN chmod 755 build.sh +ENTRYPOINT ["./build.sh"] diff --git a/zmk-config/build.sh b/zmk-config/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..47e68c78fb4a7f9114fc9cf1fca0469de8b25324 --- /dev/null +++ b/zmk-config/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +item="$1" + +git clone https://git.apiote.xyz/git/zmk-config.git config-mine + +west build -d build/left -b nice_nano_v2 -- -DSHIELD=cradio_left -DZMK_CONFIG=config-mine/config/ +west build -d build/right -b nice_nano_v2 -- -DSHIELD=cradio_right -DZMK_CONFIG=config-mine/config/ + +commit=$(git show --pretty=oneline --abbrev-commit --name-only | head -n1 | cut -d ' ' -f 1) +timestamp=$(date '+%Y%m%dT%H%M') + +if [ "${ENVIRONMENT:-production}" = 'production' ]; then + scp build/left/zephyr/zmk.elf "deploy@host.containers.internal:toys/zmk-config/${item}/left_${timestamp}_${commit}.elf" + scp build/right/zephyr/zmk.elf "deploy@host.containers.internal:toys/zmk-config/${item}/right_${timestamp}_${commit}.elf" +fi