使用heroku.yml部署到Heroku多个docker镜像,收到错误:无法检测到此应用程序的默认语言

2024-04-27

我正在尝试部署一个在本地运行的应用程序docker compose.

我遵循了文档:使用 heroku.yml 构建 Docker 镜像 https://devcenter.heroku.com/articles/build-docker-images-heroku-yml并将heroku.yml添加到git,然后推送到heroku

git push heroku master

构建失败并出现以下错误:

Enumerating objects: 6611, done.
Counting objects: 100% (6611/6611), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6417/6417), done.
Writing objects: 100% (6611/6611), 41.00 MiB | 244.00 KiB/s, done.
Total 6611 (delta 4657), reused 205 (delta 115)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to my-app.
remote: 
To https://git.heroku.com/my-app.git
 ! [remote rejected] master -> master (pre-receive hook declined)

如何解决这个问题,为什么会发生这种情况?

heroku 甚至运行yml?

// heroku.yml

setup:
  addons:
    - plan: heroku-postgresql
      as: DATABASE
  config:
  // .env vars
build:
  docker:
    web_server: web/server/dockerfile
    web_client: web/client/dockerfile
    ipfs: ipfs/dockerfile
    blockchain: blockchain/dockerfile
  config:
  // .env vars
// docker-compose.yml

version: '3.8'
services:
    ipfs:
        container_name: $IPFS_CONTAINER_NAME
        build: ./ipfs
    blockchain:
        container_name: $BLOCKCHAIN_CONTAINER_NAME
        build:
            context: ./blockchain
            dockerfile: dockerfile
            args: 
                - GETH_ACCOUNT_PASSWORD=$GETH_ACCOUNT_PASSWORD
                - GETH_NETWORK_ID=$GETH_NETWORK_ID
        env_file: 
            - ./.env
        volumes: 
            - type: volume
              source: blockchain_data
              target: /usr/src/app/chain
    db:
        container_name: $DB_CONTAINER_NAME
        image: postgres
        env_file: 
            - ./.env
        environment:
            - POSTGRES_USER=$DB_SUPER_USER
            - POSTGRES_PASSWORD=$DB_SUPER_PASSWORD
            - POSTGRES_DB=$DB_NAME
        ports: 
            - $DB_PORT_MAP
    web_server:
        container_name: $WEB_SERVER_CONTAINER_NAME
        build: ./web/server
        env_file: 
            - ./.env
        ports: 
            - $WEB_SERVER_PORT:$WEB_SERVER_PORT
        volumes: 
            - type: volume
              source: blockchain_data
              target: /usr/src/app/ipc
            - type: bind
              source: ./web/server/src
              target: /usr/src/app/src
              read_only: true
        entrypoint: ["bash", "entrypoint.sh", $ENABLE_RLS_TOGGLE, $DB_ENABLE_RLS]
    web_client:
        container_name: $WEB_CLIENT_CONTAINER_NAME
        build: ./web/client
        env_file: 
            - ./.env
        ports: 
            - $WEB_CLIENT_PORT:$WEB_CLIENT_PORT
        volumes: 
            - type: bind
              source: ./web/client/src
              target: /usr/src/app/src
              read_only: true
volumes:
    blockchain_data:


有两个问题:

  1. 我再次查看了文档,发现我跳过了一个命令heroku stack:set container

  2. running git push heroku master将本地master推送到远程master,而本地master没有heroku.yml。我试图将本地分支推送到远程主控,正确的命令是:git push heroku my-branch:master

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用heroku.yml部署到Heroku多个docker镜像,收到错误:无法检测到此应用程序的默认语言 的相关文章

随机推荐