dimanche 3 janvier 2021

How to deploy Dockerized website on Heroku

I have a simple static website with just a few lines of JavaScript. The website has been Dockerized with this Docker Compose

version: "3.8"

services:

  web:
    image: docker.io/bitnami/apache:latest
    restart: always
    ports:
      - 80:8080
      - 443:8443
    volumes:
      - .:/app

I wanted to deploy this on Heroku, but I found out docker-compose.yml are not supported. So I translated everything in a Dockerfile:

FROM docker.io/bitnami/apache:latest
COPY . /app
EXPOSE 8080
EXPOSE 8443

Now, running docker run -p 80:8080 -p 443:8443 <image-name> gives me the same results as running the docker-compose so everything works.

I want to deploy this Container on Heroku, and I made an heroku.yml

build:
 docker:
   web: Dockerfile
 config:
   REQUIREMENTS_FILENAME: heroku.yml
release:
 image: web

I don't know if this config is enough to make it run correctly on Heroku. One of the doubts I have is the port forwarding. Indeed the build succeed in Heroku but the Deploy fails (actually it seems like it is stuck in a loop).

What am I doing wrong?

Best regards




Aucun commentaire:

Enregistrer un commentaire