Last active
September 7, 2023 11:11
-
-
Save vorant94/13f0d36b3a715256442b9ea8cd2b003e to your computer and use it in GitHub Desktop.
passing secrets from gh action to docker builder
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
... | |
COPY package*.json ./ | |
RUN --mount=type=secret,id=npmrc,target=/usr/local/app/.npmrc \ | |
npm ci | |
... |
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
... | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Create authenticated .npmrc for Docker build runner | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" > $HOME/.npmrc | |
cat .npmrc >> $HOME/.npmrc | |
echo "npmrc_path=$HOME/.npmrc" >> "$GITHUB_ENV" | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: false | |
tags: vorant94-io/web:latest | |
secret-files: | | |
npmrc=${{ env.npmrc_path }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment