在 Docker Compose 中写多行文本

之前列举过 在 Taskfile 中写多行文本,在 Docker Compose 中也有写 heredoc 的需要

services:
  main:
    image: alpine
    entrypoint:
      - /bin/sh
      - "-c"
      - |
        echo hello
        echo goodbye

而在 Dockerfile 中呢,是这样 Introduction to heredocs in Dockerfiles | Docker

RUN <<EOF
apt-get update
apt-get upgrade -y
apt-get install -y ...
EOF

向 Docker Compose 服务传递主机上 certbot 管理的证书

使用 Init Container 预先使用主机上的证书和私钥填充 volume,传递给以非特权身份运行的服务容器,解决有的服务在容器中自行 useradd,以非 root 身份运行应用进程,无法读取到私钥的问题。

services:
  main:
    image: openlistteam/openlist:latest
    volumes:
      - app-certs:/certs:ro
    depends_on:
      cert:
        condition: service_completed_successfully
 
  cert:
    image: alpine
    volumes:
      - /etc/letsencrypt/live/list.home.kokomi.site:/etc/letsencrypt/live/list.home.kokomi.site:ro
      - /etc/letsencrypt/archive/list.home.kokomi.site:/etc/letsencrypt/archive/list.home.kokomi.site:ro
      - app-certs:/certs
    entrypoint:
      - /bin/sh
      - -c
      - |
        cp -L /etc/letsencrypt/live/list.home.kokomi.site/fullchain.pem /certs/fullchain.pem
        cp -L /etc/letsencrypt/live/list.home.kokomi.site/privkey.pem /certs/privkey.pem
        chown 1001:1001 /certs/*.pem
        chmod 600 /certs/*.pem
 
volumes:
  app-certs:

通达信 PLAYSOUND 函数

炒股

PLAYSOUND1 函数在每根 K 线只会触发一次,所以在日 K 上很难触发。但分时图(1 分钟线)甚至更低的 5 秒线,以及每次加载新的旧数据也会触发。