Heroku.yml 没有获取 bash 脚本

Heroku.yml 没有获取 bash 脚本

我尝试使用 docker 在 heroku 中部署我的后端。这是我的heroku.yml文件

setup:
  addons:
    - plan: heroku-postgresql
      as: DATABASE
build:
  docker:
    web: mymeds/Dockerfile
release:
  image: web
  command:
    - ./release-tasks.sh
run:
  web: python manage.py run

但得到/bin/sh: 1: ./release-tasks.sh: 未找到尽管它们位于同一个文件夹中。这是我的目录结构 目录结构

Dec 15 05:58:17 mymedsbackend app/api Starting process with command `/bin/sh -c 'if curl $HEROKU_RELEASE_LOG_STREAM --silent --connect-timeout 10 --retry 3 --retry-delay 1 >/tmp/log-stream; then
Dec 15 05:58:17 mymedsbackend app/api   chmod u+x /tmp/log-stream
Dec 15 05:58:17 mymedsbackend app/api   /tmp/log-stream /bin/sh -c '"'"'/bin/sh -c ./release-tasks.sh'"'"'
Dec 15 05:58:17 mymedsbackend app/api else
Dec 15 05:58:17 mymedsbackend app/api   /bin/sh -c ./release-tasks.sh
Dec 15 05:58:17 mymedsbackend app/api fi'` by user [email protected]
Dec 15 05:58:22 mymedsbackend heroku/release.7559 Starting process with command `/bin/sh -c 'if curl https://heroku-release-output.s3.amazonaws.com/log-stream?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3LIQ2SWG7V76SVQ%2F20201215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201215T135816Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=4f30c56d2f692e9d76dcaaebb9920cb7097c71cedcca597e26d2228de0e8497c --silent --connect-timeout 10 --retry 3 --retry-delay 1 >/tmp/log-stream; then
  chmod u+x /tmp/log-stream
  /tmp/log-stream /bin/sh -c '"'"'/bin/sh -c ./release-tasks.sh'"'"'
else
  /bin/sh -c ./release-tasks.sh
fi'`
Dec 15 05:58:23 mymedsbackend heroku/release.7559 State changed from starting to up
Dec 15 05:58:25 mymedsbackend heroku/release.7559 Process exited with status 127
Dec 15 05:58:25 mymedsbackend heroku/release.7559 State changed from up to complete
Dec 15 05:58:25 mymedsbackend app/release.7559 /bin/sh: 1: curl: not found
Dec 15 05:58:25 mymedsbackend app/release.7559 /bin/sh: 1: ./release-tasks.sh: not found
Dec 15 05:58:27 mymedsbackend app/api Release v35 command failed by user [email protected]
Dec 15 05:59:35 mymedsbackend heroku/router at=error code=H14 desc="No web processes running" method=GET path="/robots.txt" host=mymedsbackend.herokuapp.com request_id=0640e377-880e-4e05-9fcc-c5b541020aac fwd="103.149.142.2" dyno= connect= service= status=503 bytes= protocol=https
Dec 15 05:59:35 mymedsbackend heroku/router at=error code=H14 desc="No web processes running" method=GET path="/" host=mymedsbackend.herokuapp.com request_id=0bb24c8a-9064-4d37-8c14-0ac046947583 fwd="103.149.142.2" dyno= connect= service= status=503 bytes= protocol=https
Dec 15 05:59:36 mymedsbackend heroku/router at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mymedsbackend.herokuapp.com request_id=ed25b7de-de79-479f-a060-e322534d39a4 fwd="103.149.142.2" dyno= connect= service= status=503 bytes= protocol=https

我的release-tasks.sh文件在这里

cd mymeds/
python manage.py db init
python manage.py db migrate --message 'initial database migration'
python manage.py db upgrade

答案1

您是否有复制 Dockerfile 中的文件的步骤?

我也遇到了这个问题,结果发现我的输出图像缺少 shell 脚本。

你可以通过在本地运行 docker 镜像并检查它来验证它是否被复制(Docker 桌面有一个很好的 CLI 工具,或者你可以使用docker exec

相关内容