简体   繁体   中英

deploying docker container to heroku

I built a web app using docker composer , locally. Docker composers have multiple services which inturn have their individual dockerfiles as below:

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:

How do I deploy my app to heroku ? Can it be done using docker compose file ? Or I need to build an image . I am new to heroku . Please help.

Update: Below is the output of my docker images command:

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

Your web docker file should be named something like dockerfile.web

Then you can run heroku container:push --recursive --app [YOUR_APP]

Or more specifically heroku container:push web --recursive --app [YOUR_APP]

More info on the subject

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM