Skip to content

Commit

Permalink
Reduced docker image size by 800mb (project-chip#402)
Browse files Browse the repository at this point in the history
* Reduced docker image size by 800mb

* Pin this to a version

* First pass at modularizing this, but we should get this in, so stopping here
  • Loading branch information
woody-apple authored Apr 21, 2020
1 parent 52106cc commit b3cd438
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG BUILD_VERSION

# All tools required for compilation belong in chip-build, forms "truth" for CHIP build tooling
FROM connectedhomeip/chip-build
FROM connectedhomeip/chip-build:${BUILD_VERSION}

# This Dockerfile contains things useful for an interactive development environment
ARG USERNAME=vscode
Expand Down
28 changes: 17 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "CHIP Ubuntu Development Environment",
"dockerFile": "Dockerfile",
"build": {
"dockerfile": "Dockerfile",
"args": {
// "BUILD_VERSION": "$(cat integrations/docker/images/chip-build/version)" // trying to get this to work
"BUILD_VERSION": "0.2.7"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
Expand All @@ -9,16 +15,16 @@
"remoteUser": "vscode",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"ms-azuretools.vscode-docker",
"xaver.clang-format",
"github.vscode-pull-request-github",
"maelvalais.autoconf",
"yzhang.markdown-all-in-one",
"eamodio.gitlens",
"yuichinukiyama.vscode-preview-server",
"aaron-bond.better-comments",
"foxundermoon.shell-format"
],
"ms-azuretools.vscode-docker",
"xaver.clang-format",
"github.vscode-pull-request-github",
"maelvalais.autoconf",
"yzhang.markdown-all-in-one",
"eamodio.gitlens",
"yuichinukiyama.vscode-preview-server",
"aaron-bond.better-comments",
"foxundermoon.shell-format"
],
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
Expand Down
41 changes: 23 additions & 18 deletions integrations/docker/images/chip-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,33 @@ VOLUME "/var/source"
RUN set -x \
&& apt-get update \
&& apt-get install -fy \
git \
curl \
jq \
make \
autoconf \
automake \
libtool \
pkg-config \
g++ \
clang-9 \
clang-format-9 \
clang-tidy-9 \
lcov \
shellcheck \
libssl-dev \
unzip \
wget \
libmbedtls-dev \
git \
curl \
jq \
make \
autoconf \
automake \
libtool \
pkg-config \
g++ \
clang-9 \
clang-format-9 \
clang-tidy-9 \
lcov \
shellcheck \
libssl-dev \
unzip \
wget \
libmbedtls-dev \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# Install specific release of openssl
RUN set -x \
&& cd /tmp && wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1f.zip \
&& mkdir -p /tmp/openssl && cd /tmp/openssl && unzip ../OpenSSL_1_1_1f.zip \
&& cd /tmp/openssl/openssl-OpenSSL_1_1_1f && ./config && make && make install \
&& rm -rf /tmp/OpenSSL_1_1_1f.zip \
&& : # last line

# nRF5 SDK, needed for building Nordic Platform code
Expand All @@ -41,6 +43,7 @@ RUN set -x \
&& (mkdir /var/nRF5_SDK_for_Thread_and_Zigbee \
&& cd /var/nRF5_SDK_for_Thread_and_Zigbee \
&& unzip /tmp/nRF5SDKforThreadandZigbee.zip) \
&& rm -rf /tmp/nRF5SDKforThreadandZigbee.zip \
&& : # last line

# Tools for flashing software on Nordic devices, and accessing device logs
Expand All @@ -51,6 +54,8 @@ RUN set -x \
&& dpkg -i JLink_Linux_*.deb \
&& dpkg -i nRF-Command-Line-Tools_*.deb \
&& tar zxvf nRF-Command-Line-Tools_*.tar.gz) \
&& rm -rf /var/nRF5_tools/*.tar.gz \
&& rm -rf /var/nRF5_tools/*.deb \
&& : # last line

# GNU ARM Embedded toolchain, cross compiler for various platform builds
Expand Down
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.2.6
0.2.7

0 comments on commit b3cd438

Please sign in to comment.