build a docker image containing a github packages module #61644
-
Select Topic AreaQuestion Bodyi have an app that uses some private npm packages hosted on github-packages. they can be accesed via the now i want to containerize that image using docker and host the image with github-packages now when i want to build the package in github actions and npm wants to install the dependencies in the image, there is an acces error when trying to fetch the npm package hosted on gh-packages. i tried giving the npm in the image an npmrc file with secret files: - name: create .npmrc
run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}\n@MeroFuruya:registry=https://npm.pkg.github.com/" > .secret_npmrc
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
secrets: |
id=npmrc,src=./.secret_npmrc
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
i always get this error:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Did you ever figure out this? I'm getting the same error when trying to build my image. |
Beta Was this translation helpful? Give feedback.
-
hey @yalegria, yeah i do remember figuring a way out.. checked the commit log real quick. only difference i see is that i cretaed and mounted the file in another way: - name: create .npmrc
run: 'echo -e "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN\n@mac-brand-spaces:registry=https://npm.pkg.github.com/" > .secret_npmrc'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
secret-files: |
"npmrc=./.secret_npmrc"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
hope this helps ❤️ |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
hey @yalegria, yeah i do remember figuring a way out..
but i dont remember exacly what i did to make it work.
checked the commit log real quick. only difference i see is that i cretaed and mounted the file in another way: