I have this docker file for a nodejs express app:
FROM node:lts-alpine3.20
RUN echo $(node -v)
COPY . /app/
WORKDIR /app/
ENV CI_GITHUB_TOKEN=my_github_token_hardcoded_directly
RUN echo "//npm.pkg.github.com/:_authToken=${CI_GITHUB_TOKEN}" > ~/.npmrc
RUN npm i
RUN npm run build
EXPOSE 5000
CMD ["npm", "start"]
When I run it locally via cmd docker build .
it works. But when I run it on my ElasticBeanstalk app it fails with an error: “401 Unauthorized – GET https://npm.pkg.github.com/download/SOME_PRIVATE_REPO – unauthenticated: User cannot be authenticated with the token provided.”
No idea how this is possible, that’s the whole reason I hardcoded the github_token
into the DockerFile, so that I don’t need to mess around with ENV’s and all that. (I’ll worry about the security implications later)
Any ideas?