Skip to content

Commit

Permalink
Added Dockerfile and publish action to push docker package
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak-Shaha committed Oct 8, 2024
1 parent 8bec7e7 commit d924c9f
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Docker
on:
push:
paths:
- 'Docker/Dockerfile'
- '.github/workflows/publish.yml'
- 'Docker/requirements.txt'
jobs:
publish-matter-extension-dependencies-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the matter_extension_dependencies Docker image
run: |
SiSDK="SiSDK-2024.06.2"
WiFiSDK="WiFiSDK-3.3.1"
VERSION="${SiSDK}_${WiFiSDK}"
docker build -f Docker/Dockerfile . --tag ghcr.io/siliconlabssoftware/matter_extension_dependencies:${VERSION}
docker run ghcr.io/siliconlabssoftware/matter_extension_dependencies:${VERSION}
docker push ghcr.io/siliconlabssoftware/matter_extension_dependencies:${VERSION}
85 changes: 85 additions & 0 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
ARG VERSION=latest
FROM ghcr.io/project-chip/chip-build:${VERSION} as build
LABEL org.opencontainers.image.source https://github.com/SiliconLabsSoftware/matter_extension

# Requirements to clone SDKs in temporary container
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
git \
git-lfs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# Install Arm GNU Toolchain
RUN wget -O gcc.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz?rev=7bd049b7a3034e64885fa1a71c12f91d&hash=732D909FA8F68C0E1D0D17D08E057619" \
&& tar -xJf ./gcc.tar.xz -C /tmp \
&& rm ./gcc.tar.xz \
&& : # last line

# Download Simplicity Commander
RUN wget https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip \
&& unzip ./SimplicityCommander-Linux.zip -d /tmp \
&& find /tmp/SimplicityCommander-Linux -name 'Commander_linux_x86_64*' -exec tar -xvjf {} -C /tmp/SimplicityCommander-Linux \; \
&& rm ./SimplicityCommander-Linux.zip \
&& : # last line

# Download Simplicity SDK v2024.6.1 (a1a37fa)
RUN wget https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6.2/gecko-sdk.zip -O /tmp/simplicity_sdk.zip \
&& unzip /tmp/simplicity_sdk.zip -d /tmp/simplicity_sdk \
&& rm -rf /tmp/simplicity_sdk.zip \
&& rm -rf /tmp/simplicity_sdk/protocol/flex /tmp/simplicity_sdk/protocol/z-wave /tmp/simplicity_sdk/protocol/wisun \
&& find /tmp/simplicity_sdk/protocol/openthread -name "*efr32mg21*" -delete \
&& : # last line

# Clone WiSeConnect Wi-Fi and Bluetooth Software 2.10.0 (f94b83d)
RUN git clone --depth=1 --single-branch --branch=2.10.0 https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git /tmp/wiseconnect-wifi-bt-sdk \
&& cd /tmp/wiseconnect-wifi-bt-sdk \
&& rm -rf .git \
&& : # last line

# Clone WiSeConnect SDK v3.3.1 (841ea3f)
RUN git clone --depth=1 --single-branch --branch=v3.3.1 https://github.com/SiliconLabs/wiseconnect.git /tmp/wifi_sdk \
&& cd /tmp/wifi_sdk \
&& rm -rf .git \
&& : # last line

# SLC-cli install
RUN wget https://www.silabs.com/documents/login/software/slc_cli_linux.zip \
&& unzip ./slc_cli_linux.zip -d /tmp \
&& rm ./slc_cli_linux.zip \
&& : # last line

# Final SDK container for compiling using Silabs SDK
FROM ghcr.io/project-chip/chip-build:${VERSION}

ADD Docker/requirements.txt /tmp/requirements.txt

# Cross compiler for various platform builds
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
openjdk-17-jdk-headless \
ccache \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
# Install Python Packages
&& pip3 install --break-system-packages -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt \
&& : # last line

ENV SISDK_ROOT=/opt/silabs/simplicity_sdk/
ENV WISECONNECT_SDK_ROOT=/opt/silabs/wiseconnect-wifi-bt-sdk/
ENV WIFI_SDK_ROOT=${SISDK_ROOT}/extension/wiseconnect
ENV POST_BUILD_EXE="/opt/silabs/SimplicityCommander/commander/commander"
ENV PATH="${PATH}:/opt/silabs/slc_cli/"
ENV ARM_GCC_DIR="/opt/silabs/arm-gcc-dir/"
ENV PATH="${PATH}:${ARM_GCC_DIR}/bin"

COPY --from=build /tmp/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi ${ARM_GCC_DIR}
COPY --from=build /tmp/SimplicityCommander-Linux /opt/silabs/SimplicityCommander/
COPY --from=build /tmp/simplicity_sdk ${SISDK_ROOT}
COPY --from=build /tmp/wiseconnect-wifi-bt-sdk/ ${WISECONNECT_SDK_ROOT}
COPY --from=build /tmp/wifi_sdk ${WIFI_SDK_ROOT}
COPY --from=build /tmp/slc_cli /opt/silabs/slc_cli
9 changes: 9 additions & 0 deletions Docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# codegen.py build requirements
Jinja2==3.1.3
lark==1.1.7
# Sphinx dependencies (for slc-cli)
linkify-it-py==2.0.2
myst-parser==2.0.0
Sphinx==7.2.6
sphinx-rtd-theme==1.3.0
sphinx-tabs==3.4.1

0 comments on commit d924c9f

Please sign in to comment.