Dockerfile 1.5 KB

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