Dockerfile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. FROM golang:1.15-buster AS builder
  2. LABEL stage=gobuilder
  3. ENV CGO_ENABLED 1
  4. ENV GO111MODULE=on
  5. ENV GOOS linux
  6. ENV GOPROXY https://goproxy.cn,direct
  7. # 切换工作目录
  8. WORKDIR /homelab/buildspace
  9. COPY . .
  10. # 执行编译,-o 指定保存位置和程序编译名称
  11. RUN go build -ldflags="-s -w" -o /app/chinesesubfinder
  12. # 运行时环境
  13. FROM lsiobase/ubuntu:bionic
  14. ENV TZ=Asia/Shanghai \
  15. PUID=1026 PGID=100
  16. RUN ln -s /root/.cache/rod/chromium-856583/chrome-linux/chrome /usr/bin/chrome && \
  17. # sed -i "s@http://archive.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && \
  18. apt-get update && \
  19. apt-get install --no-install-recommends -y \
  20. # C、C++ 支持库
  21. libgcc-6-dev libstdc++6 \
  22. # chromium dependencies
  23. libnss3 \
  24. libxss1 \
  25. libasound2 \
  26. libxtst6 \
  27. libgtk-3-0 \
  28. libgbm1 \
  29. ca-certificates \
  30. wget \
  31. # fonts
  32. fonts-liberation fonts-noto-color-emoji fonts-noto-cjk \
  33. # processs reaper
  34. dumb-init \
  35. # headful mode support, for example: $ xvfb-run chromium-browser --remote-debugging-port=9222
  36. xvfb \
  37. # cleanup
  38. && apt-get clean \
  39. && rm -rf \
  40. /tmp/* \
  41. /var/lib/apt/lists/* \
  42. /var/tmp/*
  43. COPY Docker/root/ /
  44. # 主程序
  45. COPY --from=builder /app/chinesesubfinder /app/chinesesubfinder
  46. # 配置文件
  47. COPY --from=builder /homelab/buildspace/config.yaml.sample /app/config.yaml
  48. VOLUME /config /media