Skip to content

Commit

Permalink
Add Dockerfile argument for variable clone depth
Browse files Browse the repository at this point in the history
  • Loading branch information
timoxd7 committed Nov 21, 2023
1 parent a7fbf45 commit 58cbbd8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
ARG IDF_CLONE_BRANCH_OR_TAG=master
ARG IDF_CHECKOUT_REF=
ARG IDF_CLONE_SHALLOW=
ARG IDF_CLONE_SHALLOW_DEPTH=1
ARG IDF_INSTALL_TARGETS=all

ENV IDF_PATH=/opt/esp/idf
Expand All @@ -65,14 +66,14 @@ RUN if [ "$IDF_INSTALL_TARGETS" = "all" ]; then \

RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_BRANCH_OR_TAG && \
git clone --recursive \
${IDF_CLONE_SHALLOW:+--depth=1 --shallow-submodules} \
${IDF_CLONE_SHALLOW:+--depth=${IDF_CLONE_SHALLOW_DEPTH} --shallow-submodules} \
${IDF_CLONE_BRANCH_OR_TAG:+-b $IDF_CLONE_BRANCH_OR_TAG} \
$IDF_CLONE_URL $IDF_PATH && \
git config --system --add safe.directory $IDF_PATH && \
if [ -n "$IDF_CHECKOUT_REF" ]; then \
cd $IDF_PATH && \
if [ -n "$IDF_CLONE_SHALLOW" ]; then \
git fetch origin --depth=1 --recurse-submodules ${IDF_CHECKOUT_REF}; \
git fetch origin --depth=${IDF_CLONE_SHALLOW_DEPTH} --recurse-submodules ${IDF_CHECKOUT_REF}; \
fi && \
git checkout $IDF_CHECKOUT_REF && \
git submodule update --init --recursive; \
Expand Down

0 comments on commit 58cbbd8

Please sign in to comment.