Skip to content

Commit

Permalink
Implement Docker best practices on k32w image (#10041)
Browse files Browse the repository at this point in the history
Some of these best practices are:
* Multi-stage builds
* Pin versions
* Avoid additional packages installation
* Clean all missing after apt command

Signed-off-by: Victor Morales <v.morales@samsung.com>
  • Loading branch information
electrocucaracha authored and pull[bot] committed Jan 30, 2022
1 parent b49c3ed commit 2310443
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions integrations/docker/images/chip-build-k32w/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
ARG VERSION=latest
FROM connectedhomeip/chip-build:${VERSION}
FROM connectedhomeip/chip-build:${VERSION} as build

# Setup the K32W SDK
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y wget unzip \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
wget=1.20.3-1ubuntu1 \
unzip=6.0-25ubuntu1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& mkdir -p /opt/sdk \
&& cd /opt/sdk \
&& wget https://mcuxpresso.nxp.com/eclipse/sdk/2.6.4/plugins/com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.4.201911251446.jar \
&& unzip com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.4.201911251446.jar \
&& rm -rf com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.4.201911251446.jar \
&& cd sdks \
&& unzip 1190028246d9243d9a9e27ca783413a8.zip \
&& rm -rf 1190028246d9243d9a9e27ca783413a8.zip \
&& : # last line

WORKDIR /opt/sdk
# Setup the K32W SDK
RUN set -x \
&& wget -O /tmp/sdk.jar https://mcuxpresso.nxp.com/eclipse/sdk/2.6.4/plugins/com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.4.201911251446.jar \
&& unzip /tmp/sdk.jar \
&& unzip sdks/1190028246d9243d9a9e27ca783413a8.zip -d sdks \
&& rm -rf sdks/1190028246d9243d9a9e27ca783413a8.zip \
&& : # last line

FROM connectedhomeip/chip-build:${VERSION}

COPY --from=build /opt/sdk/sdks/ /opt/sdk/sdks/

ENV K32W061_SDK_ROOT=/opt/sdk/sdks
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.19 Version bump reason: Update AmebaD to not require python2 anymore
0.5.20 Version bump reason: Improve K32W Docker image

0 comments on commit 2310443

Please sign in to comment.