diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0f5969e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM ubuntu:22.04 as base +WORKDIR /workdir + +ARG sdk_version=v2.3.0 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get -y install wget unzip + +# Install toolchain +# Make nrfutil install in a shared location, because when used with GitHub +# Actions, the image will be launched with the home dir mounted from the local +# checkout. +ENV NRFUTIL_HOME=/usr/local/share/nrfutil +RUN wget -q https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil && \ + mv nrfutil /usr/local/bin && \ + chmod +x /usr/local/bin/nrfutil && \ + nrfutil install toolchain-manager && \ + nrfutil install toolchain-manager search && \ + nrfutil toolchain-manager install --ncs-version ${sdk_version} && \ + nrfutil toolchain-manager list + +# +# ClangFormat +# +RUN apt-get -y install clang-format && \ + wget -qO- https://raw.githubusercontent.com/nrfconnect/sdk-nrf/${sdk_version}/.clang-format > /workdir/.clang-format + + + +# Prepare image with a ready to use build environment +SHELL ["nrfutil","toolchain-manager","launch","/bin/bash","--","-c"] +RUN west init -m https://github.com/nrfconnect/sdk-nrf --mr ${sdk_version} . && \ + west update --narrow -o=--depth=1 + +# Launch into build environment with the passed arguments +# Currently this is not supported in GitHub Actions +# See https://github.com/actions/runner/issues/1964 +ENTRYPOINT [ "nrfutil", "toolchain-manager", "launch", "/bin/bash", "--", "/root/entrypoint.sh" ] +COPY ./entrypoint.sh /root/entrypoint.sh diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..ca4b5f6 --- /dev/null +++ b/action.yml @@ -0,0 +1,17 @@ +name: 'NRF Connect SDK' +description: 'Building nrf connect sdk projects' +inputs: + board: # id of input + description: 'Board for build' + required: true + build_dir: + description: 'Building directory' + required: true + default: 'build' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - west + - build + - --board nrf52833dk_nrf52833 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5c3d3a1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '2' + +services: + nrf: + container_name: nrf + build: + context: . + dockerfile: Dockerfile + args: + - sdk_version=v2.3.0 + + diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..9de3ff2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +. /workdir/zephyr/zephyr-env.sh + +exec $@