将docker容器部署到heroku

时间:2017-08-27 16:32:14

标签: php docker heroku docker-compose dockerfile

我在本地使用docker composer构建了一个Web应用程序。 Docker作曲家有多个服务,其中包含各自的dockerfiles,如下所示:

version: '2'
services:

  # The Application
  app:
    build:
      context: ./
      dockerfile: app.dockerfile
    working_dir: /var/www
    volumes:
      - ./:/var/www
    environment:
      - "DB_PORT=3306"
      - "DB_HOST=database"

  # The Web Server
  web:
    build:
      context: ./
      dockerfile: web.dockerfile
    working_dir: /var/www
    volumes_from:
      - app
    ports:
      - 9002:80

  # The Database
  database:
    image: mysql:5.6
    volumes:
      - dbdata:/var/lib/mysql
    environment:
      - "MYSQL_ROOT_PASSWORD=****"
      - "MYSQL_DATABASE=****"
      - "MYSQL_USER=***"
    ports:
        - "33061:3306"

  #Cache
  memcached:
    image: memcached
    ports:
        - "11211:11211"
    mem_limit: 1g
    command: memcached -m 1024m

volumes:
  dbdata:

如何将我的应用部署到heroku?可以使用docker compose文件完成吗?或者我需要建立一个图像。 我是heroku的新手。请帮忙。

更新:以下是我的docker images命令的输出:

REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
<none>               <none>              dbdc39e8d1ae        36 hours ago        415MB
<none>               <none>              6e6ebf3dc133        36 hours ago        559MB
simplesms_app        latest              d43e46560ed8        46 hours ago        761MB
simplesms_web        latest              d1923872bf33        2 days ago          182MB
<none>               <none>              715ac76296bf        2 days ago          756MB
php                  7-apache            a47f065418d5        3 weeks ago         391MB
php                  7.0-apache          a47f065418d5        3 weeks ago         391MB
runwaytest_web       latest              a47f065418d5        3 weeks ago         391MB
php                  7.0-fpm             62e3017b4758        3 weeks ago         380MB
nginx                latest              b8efb18f159b        4 weeks ago         107MB
mysql                5.6                 cdfa8cc50c33        4 weeks ago         298MB
mysql                5.7                 c73c7527c03a        4 weeks ago         412MB
mysql                latest              c73c7527c03a        4 weeks ago         412MB
memcached            latest              0b0366c7c206        4 weeks ago         58.6MB
hello-world          latest              1815c82652c0        2 months ago        1.84kB
nginx                1.10                0346349a1a64        5 months ago        182MB
startx/sv-memcache   latest              706858567fa8        10 months ago       253MB
php                  7.0.5-fpm           e6673411c12c        16 months ago       501MB
php                  7.0.4-fpm           81d7a2fdc6dc        17 months ago       494MB

1 个答案:

答案 0 :(得分:0)

您的网站泊坞窗文件的名称应为plt.contourf(x, x, z, cmap=plt.cm.coolwarm) plt.colorbar(ticks=np.linspace(0, 1, 5))

然后您可以运行dockerfile.web

或更具体地说heroku container:push --recursive --app [YOUR_APP]

More info on the subject