user3035623
user3035623

Reputation: 183

deploy docker to heroku without using heroku docker plugin

Say I'm working on a web project that runs gitlab-ci shell runner on my own ci server to build docker and deploy it to heroku, and I've gone through some docs from both gitlab and heroku like gitlab-ci: using docker build and heroku:Build and Deploy with Docker. Can I deploy the docker project without using heroku-docker plugin, which seems not so flexible to me? However I tried, the following approach build succeeded in deploying to heroku, but the app crash. Heroku logs says start script is missing in package.json, but since I'm deploying docker project, I couldn't do "start": "docker-compose up" there, could I?

    #.gitlab-ci.yml
    stages:
      - deploy
    before_script:
      - npm install
      - bower install
    dev:
      stage: deploy
      script:
        - docker-compose run nginx run-test
        - gem install dpl
        - dpl --provider=heroku --app=xixi-web-dev --api-key=$HEROKU_API_KEY
      only:
        - dev

    # docker-compose.yml
    app:
      build: .
      volumes:
        - .:/code:ro
      expose:
        - "3000"
      working_dir: /code
      command: pm2 start app.dev.json5

    nginx:
      build: ./setup/nginx
      restart: always
      volumes:
        - ./setup/nginx/sites-enabled:/etc/nginx/sites-enabled:ro
        - ./dist:/var/app:ro
      ports:
        - "$PORT:80"
      links:
        - app

I don't want to use heroku docker plugin, because it seems less flexible, I can't create a app.json because I don't want to use an existing docker image for my app. Instead, I define custom Dockerfiles for app and nginx used in docker-compose.yml


Now it seems that heroku wouldn't detect my project as a docker project unless I deploy it by using heroku docker plugin, but as I mentioned above, I can't do that. Then is there any docs I'm missing on heroku or gitlab could help me out? Or do you have any idea that might be helpful? Thanks a lot!

Upvotes: 2

Views: 1047

Answers (1)

user3035623
user3035623

Reputation: 183

OK, seems that heroku docker:release is required. I ended up installing heroku cli and heroku docker plugin on my CI server and use heroku docker:release --app app to release my app

Upvotes: 1

Related Questions