-
Notifications
You must be signed in to change notification settings - Fork 181
Add lib-builder docker image #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
cd6f3bd
Test docker Image
lucasssvaz a635979
Fix Dockerfile
lucasssvaz 1768d26
Fix file permissions
lucasssvaz 750c991
Fix bugs and add run script
lucasssvaz a4ee927
Update tools/docker/Dockerfile
lucasssvaz c93cfec
Add textual to docker image
lucasssvaz f9e16c8
Reorder
lucasssvaz ec816df
Fix
lucasssvaz 1e327a2
Test
lucasssvaz 9a74157
Fix
lucasssvaz be7d72b
Merge branch 'master' into feature/docker
me-no-dev 920e3dd
Merge branch 'master' into feature/docker
lucasssvaz d87db7d
Add UI checks
lucasssvaz e98f227
Fix docker image
lucasssvaz c3c1587
Fix exec in docker
lucasssvaz 69d1573
Move argument
lucasssvaz 74290ef
Add workflow
lucasssvaz a11164c
Add checks to entrypoint
lucasssvaz 52e00bd
Improvements to Dockerfile
lucasssvaz c4f4ce3
Test example run scripts
lucasssvaz 36acb43
Fix powershell script
lucasssvaz 1cf54a3
Change parameter name
lucasssvaz 7f79287
Add comment
lucasssvaz 22b8489
Add Readme
lucasssvaz d0ada4a
Fix comparison
lucasssvaz 16e4611
Remove cache
lucasssvaz 203237d
Fix comment
lucasssvaz 297b88b
Improve permission settings
lucasssvaz cfe8da7
Add warning
lucasssvaz a6ae4a6
Update readme
lucasssvaz c0b622d
Merge branch 'master' into feature/docker
lucasssvaz 671b1b6
Fix repositories
lucasssvaz ac5225a
Merge branch 'master' into feature/docker
lucasssvaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
FROM ubuntu:22.04 | ||
|
||
# switch to root, let the entrypoint drop back to host user | ||
USER root | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN : \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
bison \ | ||
ccache \ | ||
cmake \ | ||
curl \ | ||
flex \ | ||
git \ | ||
gperf \ | ||
jq \ | ||
libncurses-dev \ | ||
libssl-dev \ | ||
libusb-1.0 \ | ||
ninja-build \ | ||
patch \ | ||
python3 \ | ||
python3-click \ | ||
python3-cryptography \ | ||
python3-future \ | ||
python3-pip \ | ||
python3-pyelftools \ | ||
python3-pyparsing \ | ||
python3-serial \ | ||
python3-setuptools \ | ||
python3-venv \ | ||
wget \ | ||
&& pip install --upgrade pip \ | ||
&& apt-get autoremove -y \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& : | ||
|
||
# install gosu for a better su+exec command | ||
ARG GOSU_VERSION=1.17 | ||
RUN dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ | ||
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \ | ||
&& chmod +x /usr/local/bin/gosu \ | ||
&& gosu nobody true | ||
|
||
# To build the image for a branch or a tag of the lib-builder, pass --build-arg LIBBUILDER_CLONE_BRANCH_OR_TAG=name. | ||
# To build the image with a specific commit ID of lib-builder, pass --build-arg LIBBUILDER_CHECKOUT_REF=commit-id. | ||
# It is possibe to combine both, e.g.: | ||
# LIBBUILDER_CLONE_BRANCH_OR_TAG=release/vX.Y | ||
# LIBBUILDER_CHECKOUT_REF=<some commit on release/vX.Y branch>. | ||
# Use LIBBUILDER_CLONE_SHALLOW=1 to peform shallow clone (i.e. --depth=1 --shallow-submodules) | ||
# Use LIBBUILDER_CLONE_SHALLOW_DEPTH=X to define the depth if LIBBUILDER_CLONE_SHALLOW is used (i.e. --depth=X) | ||
# Use IDF_INSTALL_TARGETS to install tools only for selected chip targets (CSV) | ||
|
||
ARG LIBBUILDER_CLONE_URL=https://github.com/espressif/esp32-arduino-lib-builder | ||
ARG LIBBUILDER_CLONE_BRANCH_OR_TAG=master | ||
ARG LIBBUILDER_CHECKOUT_REF= | ||
ARG LIBBUILDER_CLONE_SHALLOW= | ||
ARG LIBBUILDER_CLONE_SHALLOW_DEPTH=1 | ||
ARG LIBBUILDER_TARGETS=all | ||
|
||
ENV LIBBUILDER_PATH=/opt/esp/lib-builder | ||
ENV ARDUINO_PATH=/opt/esp/lib-builder/arduino-esp32 | ||
|
||
RUN echo LIBBUILDER_CHECKOUT_REF=$LIBBUILDER_CHECKOUT_REF LIBBUILDER_CLONE_BRANCH_OR_TAG=$LIBBUILDER_CLONE_BRANCH_OR_TAG && \ | ||
git clone --recursive \ | ||
${LIBBUILDER_CLONE_SHALLOW:+--depth=${LIBBUILDER_CLONE_SHALLOW_DEPTH} --shallow-submodules} \ | ||
${LIBBUILDER_CLONE_BRANCH_OR_TAG:+-b $LIBBUILDER_CLONE_BRANCH_OR_TAG} \ | ||
$LIBBUILDER_CLONE_URL $LIBBUILDER_PATH && \ | ||
git config --system --add safe.directory $LIBBUILDER_PATH && \ | ||
if [ -n "$LIBBUILDER_CHECKOUT_REF" ]; then \ | ||
cd $LIBBUILDER_PATH && \ | ||
if [ -n "$LIBBUILDER_CLONE_SHALLOW" ]; then \ | ||
git fetch origin --depth=${LIBBUILDER_CLONE_SHALLOW_DEPTH} --recurse-submodules ${LIBBUILDER_CHECKOUT_REF}; \ | ||
fi && \ | ||
git checkout $LIBBUILDER_CHECKOUT_REF && \ | ||
git submodule update --init --recursive; \ | ||
fi | ||
|
||
COPY entrypoint.sh $LIBBUILDER_PATH/entrypoint.sh | ||
|
||
# Ccache is installed, enable it by default | ||
ENV IDF_CCACHE_ENABLE=1 | ||
|
||
WORKDIR /opt/esp/lib-builder | ||
ENTRYPOINT [ "/opt/esp/lib-builder/entrypoint.sh" ] | ||
CMD [ "bash" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# LIBBUILDER_GIT_SAFE_DIR has the same format as system PATH environment variable. | ||
# All path specified in LIBBUILDER_GIT_SAFE_DIR will be added to user's | ||
# global git config as safe.directory paths. For more information | ||
# see git-config manual page. | ||
if [ -n "${LIBBUILDER_GIT_SAFE_DIR+x}" ] | ||
then | ||
echo "Adding following directories into git's safe.directory" | ||
echo "$LIBBUILDER_GIT_SAFE_DIR" | tr ':' '\n' | while read -r dir | ||
do | ||
git config --global --add safe.directory "$dir" | ||
echo " $dir" | ||
done | ||
fi | ||
|
||
if [ "$(id -u)" = "0" ] && [ -n "${HOST_UID}" ]; then | ||
groupadd -g ${HOST_UID} host_user | ||
useradd -m -u ${HOST_UID} -g ${HOST_UID} host_user | ||
|
||
if [ -d /arduino-esp32 ]; then | ||
chown -R ${HOST_UID}:${HOST_UID} /arduino-esp32 | ||
fi | ||
|
||
chown -R ${HOST_UID}:${HOST_UID} /opt/esp | ||
|
||
# Add call to gosu to drop from root user to host_user | ||
# when running original entrypoint | ||
set -- gosu host_user "$@" | ||
fi | ||
|
||
exec "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
i=0 | ||
NEXT_ARG="false" | ||
ARDUINO_DIR="" | ||
DOCKER_ARGS=() | ||
ORIGINAL_ARGS=("$@") | ||
TRIMMED_ARGS=() | ||
|
||
while [ $i -lt ${#ORIGINAL_ARGS[@]} ]; do | ||
arg=${ORIGINAL_ARGS[$i]} | ||
if [ $arg == "-c" ]; then | ||
NEXT_ARG="true" | ||
elif [ $NEXT_ARG == "true" ]; then | ||
ARDUINO_DIR=$arg | ||
NEXT_ARG="false" | ||
else | ||
TRIMMED_ARGS+=($arg) | ||
fi | ||
i=$((i + 1)) | ||
done | ||
|
||
if [ -n "$ARDUINO_DIR" ]; then | ||
if [ ! -d "$ARDUINO_DIR" ]; then | ||
echo "Arduino directory \"$ARDUINO_DIR\" does not exist" | ||
exit 1 | ||
fi | ||
ARDUINO_DIR=$(echo $(cd $ARDUINO_DIR; pwd)) | ||
DOCKER_ARGS+=(-v $ARDUINO_DIR:/arduino-esp32) | ||
TRIMMED_ARGS+=(-c /arduino-esp32) | ||
fi | ||
|
||
DOCKER_ARGS+=(-e HOST_UID=$UID) | ||
|
||
if [ -n "$LIBBUILDER_GIT_SAFE_DIR" ]; then | ||
DOCKER_ARGS+=(-e LIBBUILDER_GIT_SAFE_DIR=$LIBBUILDER_GIT_SAFE_DIR) | ||
fi | ||
|
||
if [ "$VERBOSE_OUTPUT" -eq 1 ]; then | ||
echo "Arguments:" | ||
echo "DOCKER_ARGS = ${DOCKER_ARGS[@]}" | ||
echo "TRIMMED_ARGS = ${TRIMMED_ARGS[@]}" | ||
echo "Running: docker run ${DOCKER_ARGS[@]} lucassvaz/esp32-arduino-lib-builder ./build.sh ${TRIMMED_ARGS[@]}" | ||
fi | ||
|
||
docker run ${DOCKER_ARGS[@]} lucassvaz/esp32-arduino-lib-builder ./build.sh ${TRIMMED_ARGS[@]} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.