version: '3'
services:
  portainer:
    image: portainer/portainer-ce
    container_name: portainer
    environment:
      - TZ=Europe/Helsinki
    restart: unless-stopped
    networks:
      - proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /docker/portainer:/data
      - /etc/localtime:/etc/localtime:ro
    labels:
      - 'traefik.enable=true'

      - 'traefik.http.routers.portainer-redirect.entrypoints=http'
      - 'traefik.http.routers.portainer-redirect.rule=Host(`portainer.korhonen.cc`)'
      - 'traefik.http.middlewares.http2https.redirectscheme.scheme=https'
      - 'traefik.http.routers.portainer-redirect.middlewares=http2https'

      - 'traefik.http.routers.portainer.entrypoints=https'
      - 'traefik.http.routers.portainer.rule=Host(`portainer.korhonen.cc`)'
      - 'traefik.http.routers.portainer.tls=true'
      - 'traefik.http.routers.portainer.tls.certresolver=http'
      - 'traefik.http.routers.portainer.service=portainer'
      - 'traefik.docker.network=proxy'
      - 'traefik.http.services.portainer.loadbalancer.server.port=9000'

networks:
  proxy:
    external: true
