tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 97 forks source link

[BUG] Env Variable $KIMAI is emtpy string #476

Closed hexxone closed 1 year ago

hexxone commented 1 year ago

Describe the bug

The $KIMAI Environment variable isn't correctly set, causing some errors to show up on Container startup.

With the latest image, when simply starting the Container, it will print out the following error:

/startup.sh: line 41: [: : integer expression expected
/startup.sh: line 44: assets/monolog.yaml: No such file or directory

image

P.S.: In the UI of "Portainer", the $KIMAI variable also shows up as empty, which is weird because it shoule be set right here?.

The only thing I could imagine being the issue is this: https://benkyriakou.com/posts/docker-args-empty

Because you are using a lot of "FROM" Steps, and not passing the argument through.

A Fix would be simply adding ARG KIMAI behind every new FROM .. AS statement.

To Reproduce Steps to reproduce the behaviour:

  1. Start the container '...'
  2. Run docker logs kimai2
  3. Scroll up to beginning
  4. See error

Running on a Server:

Command used to run the container

Docker compose file (with passwords redacted)

timetrack_db:
    hostname: timetrack_db
    container_name: timetrack_db
    image: mysql:latest
    restart: unless-stopped
    networks:
      - tt_net
    environment:
      MYSQL_DATABASE: kimai
      MYSQL_USER: kimai
      MYSQL_PASSWORD: afdafadfadfadf
      MYSQL_ROOT_PASSWORD: sdfsdfsrf
    volumes:
      - ./kimai/database:/var/lib/mysql

  timetrack:
    hostname: timetrack
    container_name: timetrack
    image: kimai/kimai2:apache-latest
    restart: unless-stopped
    networks:
      - tt_net
      - web
    depends_on:
      - timetrack_db
    environment:
      APP_ENV: prod
      ADMINMAIL: admin@testsite.com
      ADMINPASS: 24556435456235
      DATABASE_URL: mysql://root:sdfsdfsrf@timetrack_db/kimai
      memory_limit: 2048
    labels:
      traefik.enable: true
      # HTTP -> HTTPS
      traefik.http.routers.timetrack-redirect.entrypoints: web
      traefik.http.routers.timetrack-redirect.rule: Host(`time.${HOST}`)
      traefik.http.routers.timetrack-redirect.middlewares: httpsredirect@docker
      # HTTPS -> Entry router
      traefik.http.routers.timetrack.entrypoints: websecure
      traefik.http.routers.timetrack.rule: Host(`time.${HOST}`)
      traefik.http.routers.timetrack.tls: true
      traefik.http.routers.timetrack.tls.certresolver: cfresolver
      traefik.http.routers.timetrack.middlewares: limit@docker,error-pages@docker
      traefik.http.routers.timetrack.service: timetrack
      # # Entry
      traefik.http.services.timetrack.loadbalancer.server.port: 8001
      traefik.http.services.timetrack.loadbalancer.server.scheme: http
      traefik.http.services.timetrack.loadbalancer.passHostHeader: true
    volumes:
      - ./kimai/apache2.conf:/etc/apache2/onlySaml.conf
      - ./kimai/local.yaml:/opt/kimai/config/packages/local.yaml

Additional context Tell me if you need some more infos :)

hexxone commented 1 year ago

Fixxed with PR