Update our docker config to use a layout that better matches arduino-cli

tmp/parallel-cli
Jesse Vincent 4 years ago
parent 95eefc95b2
commit 0611e35a6c
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -13,25 +13,28 @@ fi
if [ "${uname_S}" = "Darwin" ]; then
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Documents/Arduino}"
# This stops macos from copying resource forks into thigns like tar
export COPYFILE_DISABLE=true
else
ARDUINO_LOCAL_LIB_PATH="${ARDUINO_LOCAL_LIB_PATH:-${HOME}/Arduino}"
fi
BOARD_HARDWARE_PATH="${BOARD_HARDWARE_PATH:-${ARDUINO_LOCAL_LIB_PATH}/hardware}"
echo "Preparing Kaleidoscope and the bundle..."
XFER_DIR="$(pwd)/.docker_xfer"
mkdir -p "${XFER_DIR}"
tar -cf "${XFER_DIR}/kaleidoscope.tar" \
--exclude .docker_xfer --exclude .git --exclude _build --exclude testing/googletest/build \
--exclude .arduino/data \
--exclude bin/arduino-cli \
--exclude .docker_xfer \
--exclude .git \
--exclude _build \
--exclude testing/googletest/build \
.
(cd "${BOARD_HARDWARE_PATH}/keyboardio" && tar -cf "${XFER_DIR}/bundle.tar" \
echo "The bundle is coming from ${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio"
(cd "${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio" && tar -cf "${XFER_DIR}/bundle.tar" \
--exclude .git --exclude avr/libraries/Kaleidoscope .)
echo "Building the docker image..."
@ -39,11 +42,13 @@ docker build -q -t kaleidoscope/docker etc
# We do want word splitting since there are multiple options here
# shellcheck disable=SC2086
docker run --rm $DOCKER_RUN_INTERACTIVE_OPTS \
--tmpfs /kaleidoscope:exec \
--mount type=tmpfs,destination=/kaleidoscope:exec \
--mount type=bind,source="${XFER_DIR}",destination=/kaleidoscope-src,consistency=delegated,readonly \
--mount type=volume,source=kaleidoscope-persist,destination=/kaleidoscope-persist,consistency=delegated \
--mount type=volume,source=kaleidoscope-googletest-build,destination=/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/testing/googletest/build,consistency=delegated \
--mount type=volume,source=kaleidoscope-build,destination=/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/_build,consistency=delegated \
--mount type=volume,source=kaleidoscope-googletest-build,destination=/kaleidoscope/testing/googletest/build,consistency=delegated \
--mount type=volume,source=kaleidoscope-build,destination=/kaleidoscope/_build,consistency=delegated \
--env ARDUINO_DIRECTORIES_DATA=/arduino-cli/data \
--env ARDUINO_DIRECTORIES_USER=/kaleidoscope/.arduino/user/ \
kaleidoscope/docker "$*"

@ -3,20 +3,16 @@ LABEL maintainer="Keyboard.io, inc"
RUN apt-get -qq update && \
DEBIAN_FRONTEND=noninteractive \
apt-get -qq install -y xz-utils curl make build-essential libxtst-dev cmake ccache
apt-get -qq install -y xz-utils curl make build-essential libxtst-dev cmake ccache vim
RUN ccache --set-config=cache_dir=/kaleidoscope-persist/ccache/cache
ENV ARDUINO_VERSION "1.8.13"
WORKDIR /usr/local
RUN curl https://downloads.arduino.cc/arduino-${ARDUINO_VERSION}-linux64.tar.xz | \
xzcat | tar xf - && \
ln -s arduino-${ARDUINO_VERSION} arduino
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | \
sh
RUN /usr/local/bin/arduino-cli core install arduino:avr
RUN ARDUINO_DIRECTORIES_DATA=/arduino-cli/data /bin/arduino-cli config init
RUN ARDUINO_DIRECTORIES_DATA=/arduino-cli/data /bin/arduino-cli update
RUN ARDUINO_DIRECTORIES_DATA=/arduino-cli/data /bin/arduino-cli core install arduino:avr
COPY docker-entrypoint.sh /usr/local/bin/entrypoint
@ -24,10 +20,9 @@ COPY docker-entrypoint.sh /usr/local/bin/entrypoint
VOLUME ["/kaleidoscope", \
"/kaleidoscope-src", \
"/kaleidoscope-persist", \
"/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/testing/googletest/build", \
"/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope/_build"]
"/kaleidoscope/testing/googletest/build", \
"/kaleidoscope/_build"]
ENV BOARD_HARDWARE_PATH "/kaleidoscope/hardware"
ENV KALEIDOSCOPE_TEMP_PATH "/kaleidoscope-persist/temp"

@ -1,20 +1,24 @@
#! /bin/bash
set -e
install -d /kaleidoscope/hardware/keyboardio \
/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope \
install -d /kaleidoscope/ \
/kaleidoscope/.arduino/user/hardware/keyboardio \
/kaleidoscope-persist/temp \
/kaleidoscope-persist/ccache/cache
echo "Syncing the bundle..."
tar xf /kaleidoscope-src/bundle.tar -C /kaleidoscope/hardware/keyboardio
echo "Syncing Kaleidoscope..."
tar xf /kaleidoscope-src/kaleidoscope.tar -C /kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope
tar xf /kaleidoscope-src/kaleidoscope.tar -C /kaleidoscope/
echo "Syncing the bundle..."
tar xf /kaleidoscope-src/bundle.tar -C /kaleidoscope/.arduino/user/hardware/keyboardio
rm -f /kaleidoscope/.arduino/user/hardware/keyboardio/avr/libraries/Kaleidoscope
ln -s /kaleidoscope /kaleidoscope/.arduino/user/hardware/keyboardio/avr/libraries/Kaleidoscope
ln -s /kaleidoscope/hardware/keyboardio/virtual/libraries/Kaleidoscope \
/kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope
cd /kaleidoscope/hardware/keyboardio/avr/libraries/Kaleidoscope
cd /kaleidoscope/
export ARDUINO_DIRECTORIES_DATA=/arduino-cli/data
export KALEIDOSCOPE_CCACHE=1
/bin/bash -c "$*"

Loading…
Cancel
Save