├── zephyr └── Dockerfile ├── zephyr-posix └── Dockerfile ├── LICENSE ├── zephyr-base └── Dockerfile ├── README.md └── .github └── workflows └── publish.yml /zephyr/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ZEPHYR_SDK_VERSION=0.17.0 2 | ARG ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-${ZEPHYR_SDK_VERSION} 3 | ARG ZEPHYR_SDK_TOOLCHAINS="-t arm-zephyr-eabi" 4 | ARG BASE_IMAGE="zephyr:base-${ZEPHYR_SDK_VERSION}SDK" 5 | 6 | FROM ${BASE_IMAGE} 7 | 8 | # Target architecture SDK 9 | 10 | ARG ZEPHYR_SDK_INSTALL_DIR 11 | ARG ZEPHYR_SDK_TOOLCHAINS 12 | 13 | RUN \ 14 | apt-get -y update \ 15 | && apt-get -y install --no-install-recommends \ 16 | xz-utils \ 17 | wget \ 18 | && ${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -c ${ZEPHYR_SDK_TOOLCHAINS} \ 19 | && apt-get remove -y --purge \ 20 | wget \ 21 | xz-utils \ 22 | && apt-get clean \ 23 | && rm -rf /var/lib/apt/lists/* 24 | -------------------------------------------------------------------------------- /zephyr-posix/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ZEPHYR_SDK_VERSION=0.17.0 2 | ARG ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-${ZEPHYR_SDK_VERSION} 3 | ARG BASE_IMAGE="zephyr:base-${ZEPHYR_SDK_VERSION}SDK" 4 | 5 | FROM ${BASE_IMAGE} 6 | 7 | # OS dependencies and packages 8 | 9 | RUN \ 10 | apt-get -y update \ 11 | && apt-get -y install --no-install-recommends \ 12 | gcc-multilib \ 13 | make \ 14 | && apt-get clean \ 15 | && rm -rf /var/lib/apt/lists/* 16 | 17 | # Zephyr SDK 18 | 19 | ARG ZEPHYR_SDK_INSTALL_DIR 20 | 21 | RUN \ 22 | apt-get -y update \ 23 | && apt-get -y install --no-install-recommends \ 24 | wget \ 25 | && ${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -c \ 26 | && apt-get remove -y --purge \ 27 | wget \ 28 | && apt-get clean \ 29 | && rm -rf /var/lib/apt/lists/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 embeddedcontainers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /zephyr-base/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:stable-slim 2 | 3 | ARG ZEPHYR_SDK_VERSION=0.16.4 4 | ARG ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-${ZEPHYR_SDK_VERSION} 5 | 6 | # OS dependencies and packages 7 | 8 | RUN \ 9 | apt-get -y update \ 10 | && apt-get -y install --no-install-recommends \ 11 | ca-certificates \ 12 | cmake \ 13 | device-tree-compiler \ 14 | git \ 15 | ninja-build \ 16 | && apt-get clean \ 17 | && rm -rf /var/lib/apt/lists/* 18 | 19 | # Zephyr SDK 20 | 21 | RUN \ 22 | export sdk_file_name="zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-$(uname -m)_minimal.tar.xz" \ 23 | && apt-get -y update \ 24 | && apt-get -y install --no-install-recommends \ 25 | wget \ 26 | xz-utils \ 27 | && wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/${sdk_file_name}" \ 28 | && mkdir -p ${ZEPHYR_SDK_INSTALL_DIR} \ 29 | && tar -xvf ${sdk_file_name} -C ${ZEPHYR_SDK_INSTALL_DIR} --strip-components=1 \ 30 | && ${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -c \ 31 | && rm ${sdk_file_name} \ 32 | && apt-get remove -y --purge \ 33 | wget \ 34 | xz-utils \ 35 | && apt-get clean \ 36 | && rm -rf /var/lib/apt/lists/* 37 | 38 | # Python 39 | 40 | ENV VIRTUAL_ENV=/opt/venv 41 | RUN \ 42 | apt-get -y update \ 43 | && apt-get -y install --no-install-recommends \ 44 | python3 \ 45 | python3-pip \ 46 | python3-venv \ 47 | && python3 -m venv $VIRTUAL_ENV 48 | ENV PATH="$VIRTUAL_ENV/bin:$PATH" 49 | 50 | # West 51 | 52 | RUN pip install --no-cache-dir wheel west -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zephyr Container Images 2 | 3 | Develop Zephyr applications using OCI-compatible Docker images. 4 | 5 | Currently there are two types of images - a "base" image that contains the core dependencies to build a Zephyr application for a target SDK version and ones for a specific target architecture. Most users will generally interact with the architecture-specific images. 6 | 7 | # Getting container images 8 | 9 | ## Prebuilt Images 10 | 11 | The simplest way to start using these container images is with the prebuilt images provided by the project. Images are automatically generated using Github Actions and hosted on the Github Container Registry (GHCR.) GHCR is functionally equivalent to Dockerhub and can be used with standard tools like the Docker CLI. 12 | 13 | The project follows an evergreen strategy, meaning only the latest SDK release is maintained. Older SDKs are still hosted but it is recommended to build images locally in order to guarantee the latest packages and security updates are included. 14 | 15 | ### Using prebuilt images 16 | 17 | The full list of prebuilt images can be found [here](https://github.com/embeddedcontainers/zephyr/pkgs/container/zephyr/versions?filters%5Bversion_type%5D=tagged). 18 | 19 | For example, the image for the `arm` toolchain can be found [here](https://github.com/embeddedcontainers/zephyr/pkgs/container/zephyr/292819795?tag=arm-0.17.0SDK). 20 | 21 | To install via the Docker CLI: 22 | 23 | ``` 24 | $ docker pull ghcr.io/embeddedcontainers/zephyr:arm-0.17.0SDK 25 | ``` 26 | 27 | Use as base image in Dockerfile: 28 | 29 | ``` 30 | FROM ghcr.io/embeddedcontainers/zephyr:arm-0.17.0SDK 31 | ``` 32 | 33 | ## Build images locally 34 | 35 | Building images locally ensures you can trust the source of the image, as well as allow you to modify the container image configuration. 36 | 37 | ### Building with Docker CLI 38 | 39 | _Build the base image_ 40 | 41 | ``` 42 | docker build --build-arg ZEPHYR_SDK_VERSION=0.17.0 -f "./zephyr-base/Dockerfile" -t zephyr:base-0.17.0SDK "./zephyr-base" 43 | 44 | ``` 45 | 46 | _To build an image for Arm Cortex-M targets:_ 47 | 48 | 49 | ``` 50 | docker build --build-arg BASE_IMAGE="zephyr:base-0.17.0SDK" --build-arg ZEPHYR_SDK_TOOLCHAINS="-t arm-zephyr-eabi" -f "./zephyr/Dockerfile" -t zephyr:arm-0.17.0SDK "./zephyr" 51 | ``` 52 | 53 | _To build an image for multiple toolchains:_ 54 | 55 | ``` 56 | docker build --build-arg BASE_IMAGE="zephyr:base-0.17.0SDK" --build-arg ZEPHYR_SDK_TOOLCHAINS="-t arm-zephyr-eabi -t x86_64-zephyr-elf" -f "./zephyr/Dockerfile" -t zephyr:arm_x86-0.17.0SDK "./zephyr" 57 | ``` 58 | 59 | _There is a different Dockerfile for Posix target like `native_sim`. To build:_ 60 | 61 | ``` 62 | docker build --build-arg BASE_IMAGE="zephyr:base-0.17.0SDK" -f "./zephyr-posix/Dockerfile" -t zephyr:posix-0.17.0SDK "./zephyr-posix" 63 | ``` 64 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Zephyr development containers 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | base: 11 | runs-on: ubuntu-latest 12 | 13 | permissions: 14 | contents: read 15 | packages: write 16 | 17 | strategy: 18 | matrix: 19 | sdk: [0.17.4] 20 | 21 | steps: 22 | - name: Checkout repository 23 | uses: actions/checkout@v4 24 | 25 | - name: Setup Docker buildx 26 | uses: docker/setup-buildx-action@v3 27 | 28 | - name: Log into GitHub Container Registry 29 | # if: github.event_name != 'pull_request' 30 | uses: docker/login-action@v3 31 | with: 32 | registry: ghcr.io 33 | username: ${{ github.actor }} 34 | password: ${{ secrets.GITHUB_TOKEN }} 35 | 36 | - name: Build and push base image 37 | id: build-and-push 38 | uses: docker/build-push-action@v5 39 | with: 40 | context: . 41 | file: ./zephyr-base/Dockerfile 42 | # push: ${{ github.event_name != 'pull_request' }} 43 | push: true 44 | platforms: linux/amd64,linux/arm64 45 | provenance: false 46 | tags: ghcr.io/${{ github.repository_owner }}/zephyr:base-${{ matrix.sdk }}SDK 47 | build-args: | 48 | ZEPHYR_SDK_VERSION=${{ matrix.sdk }} 49 | 50 | archs: 51 | needs: [base] 52 | 53 | runs-on: ubuntu-latest 54 | 55 | permissions: 56 | contents: read 57 | packages: write 58 | 59 | strategy: 60 | matrix: 61 | sdk: [0.17.4] 62 | toolchain: [ 63 | { arch: "aarch64-zephyr-elf", nick: "aarch64"}, 64 | { arch: "arc64-zephyr-elf", nick: "arc64"}, 65 | { arch: "arc-zephyr-elf", nick: "arc"}, 66 | { arch: "arm-zephyr-eabi", nick: "arm"}, 67 | { arch: "microblazeel-zephyr-elf", nick: "microblazeel"}, 68 | { arch: "mips-zephyr-elf", nick: "mips"}, 69 | { arch: "nios2-zephyr-elf", nick: "nios2"}, 70 | { arch: "riscv64-zephyr-elf", nick: "riscv64"}, 71 | { arch: "rx-zephyr-elf", nick: "rx"}, 72 | { arch: "sparc-zephyr-elf", nick: "sparc"}, 73 | { arch: "x86_64-zephyr-elf", nick: "x86_64"}, 74 | { arch: "xtensa-amd_acp_6_0_adsp_zephyr-elf", nick: "xtensa-amd_acp_6_0_adsp"}, 75 | { arch: "xtensa-dc233c_zephyr-elf", nick: "xtensa-dc233c"}, 76 | { arch: "xtensa-espressif_esp32_zephyr-elf", nick: "xtensa-espressif_esp32"}, 77 | { arch: "xtensa-espressif_esp32s2_zephyr-elf", nick: "xtensa-espressif_esp32s2"}, 78 | { arch: "xtensa-espressif_esp32s3_zephyr-elf", nick: "xtensa-espressif_esp32s3"}, 79 | { arch: "xtensa-intel_ace15_mtpm_zephyr-elf", nick: "xtensa-intel_ace15_mtpm"}, 80 | { arch: "xtensa-intel_ace30_ptl_zephyr-elf", nick: "xtensa-intel_ace30_ptl"}, 81 | { arch: "xtensa-intel_tgl_adsp_zephyr-elf", nick: "xtensa-intel_tgl_adsp"}, 82 | { arch: "xtensa-mtk_mt818x_adsp_zephyr-elf", nick: "xtensa-mtk_mt818x_adsp"}, 83 | { arch: "xtensa-mtk_mt8195_adsp_zephyr-elf", nick: "xtensa-mtk_mt8195_adsp"}, 84 | { arch: "xtensa-mtk_mt8196_adsp_zephyr-elf", nick: "xtensa-mtk_mt8196_adsp"}, 85 | { arch: "xtensa-mtk_mt8365_adsp_zephyr-elf", nick: "xtensa-mtk_mt8365_adsp"}, 86 | { arch: "xtensa-nxp_imx_adsp_zephyr-elf", nick: "xtensa-nxp_imx_adsp"}, 87 | { arch: "xtensa-nxp_imx8m_adsp_zephyr-elf", nick: "xtensa-nxp_imx8m_adsp"}, 88 | { arch: "xtensa-nxp_imx8ulp_adsp_zephyr-elf", nick: "xtensa-nxp_imx8ulp_adsp"}, 89 | { arch: "xtensa-nxp_rt500_adsp_zephyr-elf", nick: "xtensa-nxp_rt500_adsp"}, 90 | { arch: "xtensa-nxp_rt600_adsp_zephyr-elf", nick: "xtensa-nxp_rt600_adsp"}, 91 | { arch: "xtensa-nxp_rt700_hifi1_zephyr-elf", nick: "xtensa-nxp_rt700_hifi1"}, 92 | { arch: "xtensa-nxp_rt700_hifi4_zephyr-elf", nick: "xtensa-nxp_rt700_hifi4"}, 93 | { arch: "xtensa-sample_controller_zephyr-elf", nick: "xtensa-sample_controller"}, 94 | { arch: "xtensa-sample_controller32_zephyr-elf", nick: "xtensa-sample_controller32"} 95 | ] 96 | 97 | steps: 98 | - name: Checkout repository 99 | uses: actions/checkout@v4 100 | 101 | - name: Setup Docker buildx 102 | uses: docker/setup-buildx-action@v3 103 | 104 | - name: Log into GitHub Container Registry 105 | # if: github.event_name != 'pull_request' 106 | uses: docker/login-action@v3 107 | with: 108 | registry: ghcr.io 109 | username: ${{ github.actor }} 110 | password: ${{ secrets.GITHUB_TOKEN }} 111 | 112 | - name: Build and push arch-specific images 113 | id: build-and-push 114 | uses: docker/build-push-action@v5 115 | with: 116 | context: . 117 | file: ./zephyr/Dockerfile 118 | # push: ${{ github.event_name != 'pull_request' }} 119 | push: true 120 | platforms: linux/amd64,linux/arm64 121 | provenance: false 122 | tags: ghcr.io/${{ github.repository_owner }}/zephyr:${{ matrix.toolchain.nick }}-${{ matrix.sdk }}SDK 123 | build-args: | 124 | BASE_IMAGE=ghcr.io/embeddedcontainers/zephyr:base-${{ matrix.sdk }}SDK 125 | ZEPHYR_SDK_TOOLCHAINS=-t ${{ matrix.toolchain.arch }} 126 | ZEPHYR_SDK_VERSION=${{ matrix.sdk }} 127 | 128 | posix: 129 | needs: [base] 130 | 131 | runs-on: ubuntu-latest 132 | 133 | permissions: 134 | contents: read 135 | packages: write 136 | 137 | strategy: 138 | matrix: 139 | sdk: [0.17.4] 140 | 141 | steps: 142 | - name: Checkout repository 143 | uses: actions/checkout@v4 144 | 145 | - name: Setup Docker buildx 146 | uses: docker/setup-buildx-action@v3 147 | 148 | - name: Log into GitHub Container Registry 149 | # if: github.event_name != 'pull_request' 150 | uses: docker/login-action@v3 151 | with: 152 | registry: ghcr.io 153 | username: ${{ github.actor }} 154 | password: ${{ secrets.GITHUB_TOKEN }} 155 | 156 | - name: Build and push base image 157 | id: build-and-push 158 | uses: docker/build-push-action@v5 159 | with: 160 | context: . 161 | file: ./zephyr-posix/Dockerfile 162 | # push: ${{ github.event_name != 'pull_request' }} 163 | push: true 164 | platforms: linux/amd64 165 | provenance: false 166 | tags: ghcr.io/${{ github.repository_owner }}/zephyr:posix-${{ matrix.sdk }}SDK 167 | build-args: | 168 | BASE_IMAGE=ghcr.io/embeddedcontainers/zephyr:base-${{ matrix.sdk }}SDK 169 | ZEPHYR_SDK_VERSION=${{ matrix.sdk }} 170 | --------------------------------------------------------------------------------