Dockerfile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. FROM golang:1.17-buster AS builder
  2. ARG VERSION=0.0.10
  3. LABEL stage=gobuilder
  4. # 开始编译
  5. ENV CGO_ENABLED 1
  6. ENV GO111MODULE=on
  7. ENV GOOS linux
  8. ENV GOPROXY https://goproxy.cn,direct
  9. # 切换工作目录
  10. WORKDIR /homelab/buildspace
  11. COPY . .
  12. # 执行编译,-o 指定保存位置和程序编译名称
  13. RUN cd ./cmd/chinesesubfinder \
  14. && go build -ldflags="-s -w -X main.AppVersion=${VERSION}" -o /app/chinesesubfinder
  15. # 运行时环境
  16. FROM lsiobase/ubuntu:bionic
  17. ENV TZ=Asia/Shanghai \
  18. PUID=1026 PGID=100
  19. RUN ln -s /root/.cache/rod/chromium-856583/chrome-linux/chrome /usr/bin/chrome && \
  20. # sed -i "s@http://archive.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && \
  21. apt-get update && \
  22. apt-get install --no-install-recommends -y \
  23. yasm ffmpeg \
  24. # C、C++ 支持库
  25. libgcc-6-dev libstdc++6 \
  26. # chromium dependencies
  27. libnss3 \
  28. libxss1 \
  29. libasound2 \
  30. libxtst6 \
  31. libgtk-3-0 \
  32. libgbm1 \
  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. xorg gtk2-engines-pixbuf \
  40. dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable \
  41. imagemagick x11-apps \
  42. # 通用
  43. ca-certificates \
  44. wget \
  45. # cleanup
  46. && apt-get clean \
  47. && rm -rf \
  48. /tmp/* \
  49. /var/lib/apt/lists/* \
  50. /var/tmp/*
  51. COPY Docker/root/ /
  52. # 主程序
  53. COPY --from=builder /app/chinesesubfinder /app/chinesesubfinder
  54. # 配置文件
  55. COPY --from=builder /homelab/buildspace/config.yaml.sample /app/config.yaml
  56. VOLUME /config /media