Skip to content

Commit b597124

Browse files
committed
Merge branch 'feature/add_docker_compilation_environment_for_esp8266' into 'master'
feat(tools): Add docker compilation environment for esp8266. See merge request sdk/ESP8266_RTOS_SDK!1522
2 parents f04d73a + 239c52f commit b597124

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

tools/docker/Dockerfile

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
FROM ubuntu:18.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update && apt-get install -y \
6+
vim \
7+
apt-utils \
8+
bison \
9+
ca-certificates \
10+
ccache \
11+
check \
12+
curl \
13+
flex \
14+
git \
15+
gperf \
16+
lcov \
17+
libncurses-dev \
18+
libusb-1.0-0-dev \
19+
make \
20+
ninja-build \
21+
python3 \
22+
python3-pip \
23+
unzip \
24+
wget \
25+
xz-utils \
26+
zip \
27+
&& apt-get autoremove -y \
28+
&& rm -rf /var/lib/apt/lists/* \
29+
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10
30+
31+
RUN python -m pip install --upgrade pip virtualenv
32+
33+
# To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
34+
# To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
35+
# It is possibe to combine both, e.g.:
36+
# IDF_CLONE_BRANCH_OR_TAG=release/vX.Y
37+
# IDF_CHECKOUT_REF=<some commit on release/vX.Y branch>.
38+
39+
ARG IDF_CLONE_URL=https://github.com/espressif/ESP8266_RTOS_SDK.git
40+
ARG IDF_CLONE_BRANCH_OR_TAG=master
41+
ARG IDF_CHECKOUT_REF=
42+
43+
ENV IDF_PATH=/opt/esp/ESP8266_RTOS_SDK
44+
ENV IDF_TOOLS_PATH=/opt/esp
45+
46+
RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
47+
git clone --recursive \
48+
${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
49+
$IDF_CLONE_URL $IDF_PATH && \
50+
if [ -n "$IDF_CHECKOUT_REF" ]; then \
51+
cd $IDF_PATH && \
52+
git checkout $IDF_CHECKOUT_REF && \
53+
git submodule update --init --recursive; \
54+
fi
55+
56+
# Install all the required tools, plus CMake
57+
RUN $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
58+
&& $IDF_PATH/tools/idf_tools.py --non-interactive install xtensa-lx106-elf \
59+
&& $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
60+
&& rm -rf $IDF_TOOLS_PATH/dist \
61+
&& pip install -r $IDF_PATH/requirements.txt
62+
63+
# Ccache is installed, enable it by default
64+
ENV IDF_CCACHE_ENABLE=1
65+
66+
COPY entrypoint.sh /opt/esp/entrypoint.sh
67+
68+
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
69+
70+
CMD [ "/bin/bash" ]

tools/docker/entrypoint.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
. $IDF_PATH/export.sh
5+
6+
exec "$@"

tools/docker/hooks/build

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# This file gets executed to build the image on the Docker Hub.
4+
# See https://docs.docker.com/docker-hub/builds/advanced/#build-hook-examples for details.
5+
6+
set -euo pipefail
7+
8+
echo "Building for branch ${SOURCE_BRANCH}, commit ${SOURCE_COMMIT}"
9+
10+
docker build \
11+
--build-arg IDF_CLONE_BRANCH_OR_TAG=${SOURCE_BRANCH} \
12+
--build-arg IDF_CHECKOUT_REF=${SOURCE_COMMIT} \
13+
-f $DOCKERFILE_PATH \
14+
-t $IMAGE_NAME .

0 commit comments

Comments
 (0)