Dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. ca-certificates \
  27. wget \
  28. # cleanup
  29. && apt-get clean \
  30. && rm -rf \
  31. /tmp/* \
  32. /var/lib/apt/lists/* \
  33. /var/tmp/*
  34. COPY Docker/root/ /
  35. # 主程序
  36. COPY --from=builder /app/chinesesubfinder /app/chinesesubfinder
  37. # 配置文件
  38. COPY --from=builder /homelab/buildspace/config.yaml.sample /app/config.yaml
  39. VOLUME /config /media