HTTPS with cloudflare and docker compose

I am trying to set up n8n with docker-compose and accept https traffic (required by third party webhooks) through Cloudflare. I am wondering if someone can give a simple example of how to set up the configuration, not sure what I have been doing wrong.

my .env file:

N8N_HOST=webhook.example.com
N8N_PROTOCOL=https
N8N_PORT=443
VUE_APP_URL_BASE_API=https://webhook.example.com/
WEBHOOK_TUNNEL_URL=https://webhook.example.com/

my docker-compose.yml:

version: '3.1'

services:

  postgres:
    image: postgres:11
    restart: always
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
      - POSTGRES_NON_ROOT_USER
      - POSTGRES_NON_ROOT_PASSWORD
    volumes:
      - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh

  n8n:
    image: n8nio/n8n
    restart: always
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST
      - N8N_PROTOCOL
      - N8N_PORT
      - VUE_APP_URL_BASE_API 
      - WEBHOOK_TUNNEL_URL
    ports:
      - 80:443 
      - 443:443
    links: 
      - postgres
    volumes:
   - ~/.n8n:/root/.n8n
    # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
    # when n8n tries to connect to it
    command: /bin/sh -c "sleep 5; n8n start"

Sorry, no idea right now why it does not work. But you could try to set it up with lets-encrypt. Here is a setup which should more or less work:
https://janober.keybase.pub/compose-setup.zip

It is possible though that one or two more tweaks are needed. But it should at least get you there to 95%.