Add vs code server service to docker compose service (for royroycat.com)

  code-server:
    image: codercom/code-server:4.22.0-ubuntu
    expose: 
      - 8888
    environment:
      - PASSWORD=${CODE_SERVER_PASSWORD} # change password in env file
    volumes:
      - ./config:/config
      - $PWD:/home/coder/workspace
    ports:
      - 8080:8888
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.codeserver.rule=Host(`subdomain.${DOMAIN_NAME}`)"
      - "traefik.http.routers.codeserver.entrypoints=websecure"
      - "traefik.http.routers.codeserver.tls.certresolver=letsencrypt"

用 docker 又加左 python scheduler 但又無 print 唔出野

但 call 其他野 print 又無啦啦彈翻晒出黎? 放心你個 schedulrr 同個 program 都無事

solution:

put this in docker-compose

PYTHONUNBUFFERED=1

ChatGPT ans:

If you’re using the apscheduler library in your FastAPI app running in a Docker container, and you’re not seeing print messages in the container logs, it’s possible that the messages are being buffered by the apscheduler library or the Python interpreter, and are not being immediately flushed to the Docker logs.

One way to force the print messages to be immediately flushed to the Docker logs is to set the PYTHONUNBUFFERED environment variable to 1 when running the container. This will disable output buffering in the Python interpreter, and ensure that print messages are immediately written to the Docker logs.