-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update dev and ci Dockerfile to match updater #3279
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
FROM dependabot/dependabot-core | ||
ARG CODE_DIR=/home/dependabot/dependabot-core | ||
|
||
USER root | ||
|
||
ARG USERNAME=dependabot | ||
ARG DEPENDABOT_HOME=/home/${USERNAME} | ||
ARG CODE_DIR=${DEPENDABOT_HOME}/dependabot-core | ||
|
||
# Install project dependencies as an unprivileged user | ||
RUN useradd -m ${USERNAME} && mkdir ${CODE_DIR} | ||
RUN chown -R ${USERNAME}:${USERNAME} \ | ||
${CODE_DIR} \ | ||
/usr/local/.pyenv \ | ||
/opt/go/gopath \ | ||
/opt/rust/ \ | ||
/opt/bundler/ | ||
|
||
WORKDIR ${CODE_DIR} | ||
|
||
ENV BUNDLE_PATH="/home/dependabot/.bundle" \ | ||
BUNDLE_BIN=".bundle/binstubs" \ | ||
PATH=".bundle/binstubs:$PATH:/home/dependabot/.bundle/bin" | ||
USER ${USERNAME} | ||
|
||
ENV BUNDLE_PATH="${CODE_DIR}/.bundle" \ | ||
BUNDLE_BIN=".bundle/bin" | ||
ENV PATH="$BUNDLE_BIN:$PATH:$BUNDLE_PATH/bin" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this tripped me up several times, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🦅 👁️ Good catch! |
||
|
||
COPY .rubocop.yml /home/dependabot/dependabot-core/ | ||
COPY .rubocop.yml ${CODE_DIR}/ | ||
|
||
RUN mkdir -p \ | ||
${CODE_DIR}/bundler \ | ||
|
@@ -67,23 +84,25 @@ RUN cd python && bundle install | |
RUN cd terraform && bundle install | ||
RUN cd omnibus && bundle install | ||
|
||
COPY common/ ${CODE_DIR}/common/ | ||
COPY bundler/ ${CODE_DIR}/bundler/ | ||
COPY cargo/ ${CODE_DIR}/cargo/ | ||
COPY composer/ ${CODE_DIR}/composer/ | ||
COPY dep/ ${CODE_DIR}/dep/ | ||
COPY docker/ ${CODE_DIR}/docker/ | ||
COPY elm/ ${CODE_DIR}/elm/ | ||
COPY git_submodules/ ${CODE_DIR}/git_submodules/ | ||
COPY github_actions/ ${CODE_DIR}/github_actions/ | ||
COPY go_modules/ ${CODE_DIR}/go_modules/ | ||
COPY gradle/ ${CODE_DIR}/gradle/ | ||
COPY hex/ ${CODE_DIR}/hex/ | ||
COPY maven/ ${CODE_DIR}/maven/ | ||
COPY npm_and_yarn/ ${CODE_DIR}/npm_and_yarn/ | ||
COPY nuget/ ${CODE_DIR}/nuget/ | ||
COPY python/ ${CODE_DIR}/python/ | ||
COPY terraform/ ${CODE_DIR}/terraform/ | ||
COPY omnibus/ ${CODE_DIR}/omnibus/ | ||
# Set the owner to be dependabot instead of defaulting to `root` allowing test | ||
# helpers to writing to the spec folder | ||
COPY --chown=${USERNAME}:${USERNAME} common/ ${CODE_DIR}/common/ | ||
COPY --chown=${USERNAME}:${USERNAME} bundler/ ${CODE_DIR}/bundler/ | ||
COPY --chown=${USERNAME}:${USERNAME} cargo/ ${CODE_DIR}/cargo/ | ||
COPY --chown=${USERNAME}:${USERNAME} composer/ ${CODE_DIR}/composer/ | ||
COPY --chown=${USERNAME}:${USERNAME} dep/ ${CODE_DIR}/dep/ | ||
COPY --chown=${USERNAME}:${USERNAME} docker/ ${CODE_DIR}/docker/ | ||
COPY --chown=${USERNAME}:${USERNAME} elm/ ${CODE_DIR}/elm/ | ||
COPY --chown=${USERNAME}:${USERNAME} git_submodules/ ${CODE_DIR}/git_submodules/ | ||
COPY --chown=${USERNAME}:${USERNAME} github_actions/ ${CODE_DIR}/github_actions/ | ||
COPY --chown=${USERNAME}:${USERNAME} go_modules/ ${CODE_DIR}/go_modules/ | ||
COPY --chown=${USERNAME}:${USERNAME} gradle/ ${CODE_DIR}/gradle/ | ||
COPY --chown=${USERNAME}:${USERNAME} hex/ ${CODE_DIR}/hex/ | ||
COPY --chown=${USERNAME}:${USERNAME} maven/ ${CODE_DIR}/maven/ | ||
COPY --chown=${USERNAME}:${USERNAME} npm_and_yarn/ ${CODE_DIR}/npm_and_yarn/ | ||
COPY --chown=${USERNAME}:${USERNAME} nuget/ ${CODE_DIR}/nuget/ | ||
COPY --chown=${USERNAME}:${USERNAME} python/ ${CODE_DIR}/python/ | ||
COPY --chown=${USERNAME}:${USERNAME} terraform/ ${CODE_DIR}/terraform/ | ||
COPY --chown=${USERNAME}:${USERNAME} omnibus/ ${CODE_DIR}/omnibus/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, the default To reduce repetition we need to update this, we could just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm attempted to run a |
||
|
||
RUN git config --global user.name dependabot-ci && git config --global user.email [email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,26 +15,28 @@ RUN apt-get update && apt-get install -y vim strace ltrace gdb | |
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
ARG USERNAME=dependabot | ||
ARG DEPENDABOT_HOME=/home/${USERNAME} | ||
|
||
RUN groupadd -o --gid "${USER_GID}" "${USERNAME}" && \ | ||
useradd --uid "${USER_UID}" --gid "${USER_GID}" -m "${USERNAME}" | ||
RUN chown -R "${USERNAME}":"${USERNAME}" \ | ||
/usr/local/.pyenv \ | ||
/opt/go/gopath \ | ||
/opt/rust/ | ||
/opt/rust/ \ | ||
/opt/bundler/ | ||
USER $USERNAME | ||
RUN git config --global user.name dependabot-ci && git config --global user.email [email protected] | ||
|
||
ARG CODE_DIR=/home/$USERNAME/dependabot-core | ||
ARG CODE_DIR=${DEPENDABOT_HOME}/dependabot-core | ||
|
||
RUN curl -L -o ~/.vimrc https://github.com/hmarr/dotfiles/raw/main/vimrc-vanilla.vim && \ | ||
echo 'export PS1="[dependabot-core-dev] \w \[$(tput setaf 4)\]$ \[$(tput sgr 0)\]"' >> ~/.bashrc | ||
|
||
RUN mkdir -p ${CODE_DIR}/common/lib/dependabot | ||
WORKDIR ${CODE_DIR} | ||
|
||
ENV BUNDLE_PATH="/home/$USERNAME/.bundle" \ | ||
BUNDLE_BIN=".bundle/binstubs" | ||
ENV BUNDLE_PATH="${CODE_DIR}/.bundle" \ | ||
BUNDLE_BIN=".bundle/bin" | ||
ENV PATH="$BUNDLE_BIN:$PATH:$BUNDLE_PATH/bin" | ||
|
||
COPY common/Gemfile common/dependabot-common.gemspec ${CODE_DIR}/common/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setup is the same as Dockerfile.development and the updater, previously ci would run as root having access to
/var/lib
which is the default cache directory for rubygems whenGEM_HOME
isn't set