Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Dockerfile.development
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ COPY --chown=dependabot:dependabot nuget/Gemfile nuget/dependabot-nuget.gemspec
COPY --chown=dependabot:dependabot python/Gemfile python/dependabot-python.gemspec ${CODE_DIR}/python/
COPY --chown=dependabot:dependabot pub/Gemfile pub/dependabot-pub.gemspec ${CODE_DIR}/pub/
COPY --chown=dependabot:dependabot terraform/Gemfile terraform/dependabot-terraform.gemspec ${CODE_DIR}/terraform/
ARG TARGET_ECOSYSTEM=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a code comment right above that says "If specified, will only build that ecosystem. Blank will build for all ecosystems. Speeds up any debugging that requires recompiling an ecosystem".

I realize that increase the risk of the comment going out of sync with the code, but in this case it's worth it IMO simply for discoverability if someone is skimming the source it's super easy to miss that this flag exists.

RUN GREEN='\033[0;32m'; NC='\033[0m'; \
for d in `find ${CODE_DIR} -type f -mindepth 2 -maxdepth 2 \
-not -path "${CODE_DIR}/common/Gemfile" \
-name 'Gemfile' | xargs dirname`; do \
echo && \
echo "---------------------------------------------------------------------------" && \
echo "Installing gems for ${GREEN}$(realpath --relative-to=${CODE_DIR} $d)${NC}..." && \
echo "---------------------------------------------------------------------------" && \
cd $d && bundle install; \
if [ -z "$TARGET_ECOSYSTEM" ] || [ "$d" = "${CODE_DIR}/$TARGET_ECOSYSTEM" ]; then \
echo && \
echo "---------------------------------------------------------------------------" && \
echo "Installing gems for ${GREEN}$(realpath --relative-to=${CODE_DIR} $d)${NC}..." && \
echo "---------------------------------------------------------------------------" && \
cd $d && bundle install; \
fi; \
done

COPY --chown=dependabot:dependabot omnibus/Gemfile omnibus/dependabot-omnibus.gemspec ${CODE_DIR}/omnibus/
Expand Down
6 changes: 5 additions & 1 deletion bin/docker-dev-shell
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ build_image() {
--cache-from "dependabot/dependabot-core:latest" \
-t dependabot/dependabot-core .
echo "$(tput setaf 2)=> building image from $DOCKERFILE$(tput sgr0)"
docker build --build-arg BUILDKIT_INLINE_CACHE=1 -t "$IMAGE_NAME" -f "$DOCKERFILE" .
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg "TARGET_ECOSYSTEM=${TARGET_ECOSYSTEM}" \
-t "$IMAGE_NAME" \
-f "$DOCKERFILE" .
}

IMAGE_ID=$(docker inspect --type=image -f '{{.Id}}' "$IMAGE_NAME" 2> /dev/null || true)
Expand Down