问题
I am trying to deploy a project on Heroku. I have set up bash entrypoint application, which is located in application root directory. Dockerfile content:
FROM node:10
# Create app directory
WORKDIR /usr/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
RUN entrypoint.sh
When heroku tries to deploy, it fails when calling entrypoint in this line:
RUN entrypoint.sh
It says that entrypoint.sh is not found - although it is located in project directory and it is added to container. See project structure here.
回答1:
Do you have heroku.yml
in your root dir? If so, than in your heroku.yml
under run statement you have probably defined same process, so that is why it is saying permission denied.
Two things here are important:
If run command is defined in
heroku.yml
, then Heroku uses this command instead of the one defined in dockerfile.Use
CMD
statement as this is what Heroku executes, have a look at their documentation
If you don’t include a run section, Heroku uses the CMD specified in the Dockerfile.
回答2:
Use the ENTRYPOINT directive in docker file to set a script at entrypoint
ENTRYPOINT ["./entrypoint.sh"]
Also ensure it is executable (permissions)
回答3:
You're using RUN
instead of ENTRYPOINT
.
RUN
means "run this command as part of build".ENTRYPOINT
means "set this command as what happens when you dodocker run
."
来源:https://stackoverflow.com/questions/59287314/heroku-docker-entrypoint-not-found