Created
May 29, 2019 07:59
-
-
Save ilguzin/1ccfa6884608ab73c3343814c205a62f to your computer and use it in GitHub Desktop.
Use GitHub as your private NPM registry within your Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ... | |
ARG GITHUB_TOKEN # GITHUB_TOKEN is only defined for build stage! https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line | |
RUN apk add git # This might contain more system packages depending on what is about to be installed by NPM | |
RUN git config --global url."https://${GITHUB_TOKEN}:[email protected]".insteadOf ssh://[email protected] # Force NPM to use https://${GITHUB_TOKEN}:[email protected]/<user name>/<repository>.git for modules installed from GitHub | |
COPY package.json /package.json | |
RUN npm ci | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment