Skip to content

Commit

Permalink
ci: take package-lock into account in devcontainer
Browse files Browse the repository at this point in the history
Consider package-lock.json when building the dev-container so we can
enforce a known-working dependency chain. This caused issues in the past
when commitlint and release-please had bugs in new versions  that
impacted our build pipeline.
  • Loading branch information
ferrarimarco committed Feb 13, 2024
1 parent 9b0427e commit 8a296e2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dev-dependencies/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ RUN apt-get update \
jq \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
ENV APP_DIR=/app
WORKDIR "${APP_DIR}"

COPY package.json ./
COPY package.json package-lock.json ./

ENV NPM_PACKAGES_FILE_PATH="npm-packages.txt"
RUN npm ci \
&& rm -rf ~/.npm

RUN jq '.dependencies | to_entries[] | select(.key | startswith("@commitlint/")) | .key + "@" + .value' package.json >> "${NPM_PACKAGES_FILE_PATH}" \
&& jq '.dependencies | to_entries[] | select(.key | startswith("release-please")) | .key + "@" + .value' package.json >> "${NPM_PACKAGES_FILE_PATH}" \
&& xargs npm install -g < "${NPM_PACKAGES_FILE_PATH}" \
&& rm package.json "${NPM_PACKAGES_FILE_PATH}"
ENV NODE_PATH="${APP_DIR}/node_modules"
ENV PATH="${NODE_PATH}/.bin:${PATH}"

# Split this from the previous RUN instruction so we can cache the costly installation step
# hadolint ignore=DL3059
Expand Down

0 comments on commit 8a296e2

Please sign in to comment.