Dockerfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 go build -ldflags="-s -w" ./cmd/chinesesubfinder/main.go -o /app/chinesesubfinder
  13. # 运行时环境
  14. FROM lsiobase/ubuntu:bionic
  15. ENV TZ=Asia/Shanghai \
  16. PUID=1026 PGID=100
  17. RUN ln -s /root/.cache/rod/chromium-856583/chrome-linux/chrome /usr/bin/chrome && \
  18. # sed -i "s@http://archive.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && \
  19. apt-get update && \
  20. apt-get install --no-install-recommends -y \
  21. # C、C++ 支持库
  22. libgcc-6-dev libstdc++6 \
  23. # chromium dependencies
  24. libnss3 \
  25. libxss1 \
  26. libasound2 \
  27. libxtst6 \
  28. libgtk-3-0 \
  29. libgbm1 \
  30. ca-certificates \
  31. wget \
  32. # fonts
  33. fonts-liberation fonts-noto-color-emoji fonts-noto-cjk \
  34. # processs reaper
  35. dumb-init \
  36. # headful mode support, for example: $ xvfb-run chromium-browser --remote-debugging-port=9222
  37. xvfb \
  38. # cleanup
  39. && apt-get clean \
  40. && rm -rf \
  41. /tmp/* \
  42. /var/lib/apt/lists/* \
  43. /var/tmp/*
  44. COPY Docker/root/ /
  45. # 主程序
  46. COPY --from=builder /app/chinesesubfinder /app/chinesesubfinder
  47. # 配置文件
  48. COPY --from=builder /homelab/buildspace/config.yaml.sample /app/config.yaml
  49. VOLUME /config /media