Skip to content

Commit

Permalink
🚧 Fix security flaw for docker compose (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista authored Dec 14, 2023
1 parent 905c0e2 commit f202724
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,22 @@ RUN \
# Substitute NPM_TOKEN in .npmrc
NPM_TOKEN=$NPM_TOKEN envsubst < .npmrctemplate > .npmrc && \
# Install dependencies (fail if we forgot to update the lockfile)
yarn install --prefer-offline --frozen-lockfile --non-interactive && \
#
# We will also skip the package scripts since in this operation the NPM_TOKEN is available
yarn install --prefer-offline --frozen-lockfile --non-interactive --ignore-scripts && \
# Remove .npmrc/.npmrctemplate immediately
rm -rf .npmrc .npmrctemplate

# Run the package scripts in a separate step in which the NPM_TOKEN is not available
RUN \
# Mount yarn cache
--mount=type=cache,target=/tmp/yarn_cache \
# Run the scripts
#
# yarn does not have a dedicated command to do this so to emulate that
# we will do an offline install which will reinstall the packages from local cache and run the scripts
yarn install --frozen-lockfile --offline

# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'
Expand Down

0 comments on commit f202724

Please sign in to comment.