Dockerfile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. FROM alpine:3.16 AS builder
  2. LABEL maintainer="[email protected]"
  3. ARG THREADS="4"
  4. ARG SHA=""
  5. # build minimized
  6. WORKDIR /
  7. RUN set -xe && \
  8. apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 && \
  9. apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev && \
  10. git clone https://github.com/ftk/quickjspp --depth=1 && \
  11. cd quickjspp && \
  12. git submodule update --init && \
  13. cmake -DCMAKE_BUILD_TYPE=Release . && \
  14. make quickjs -j $THREADS && \
  15. install -d /usr/lib/quickjs/ && \
  16. install -m644 quickjs/libquickjs.a /usr/lib/quickjs/ && \
  17. install -d /usr/include/quickjs/ && \
  18. install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/ && \
  19. install -m644 quickjspp.hpp /usr/include && \
  20. cd .. && \
  21. git clone https://github.com/PerMalmberg/libcron --depth=1 && \
  22. cd libcron && \
  23. git submodule update --init && \
  24. cmake -DCMAKE_BUILD_TYPE=Release . && \
  25. make libcron -j $THREADS && \
  26. install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
  27. install -d /usr/include/libcron/ && \
  28. install -m644 libcron/include/libcron/* /usr/include/libcron/ && \
  29. install -d /usr/include/date/ && \
  30. install -m644 libcron/externals/date/include/date/* /usr/include/date/ && \
  31. cd .. && \
  32. git clone https://github.com/ToruNiina/toml11 --branch="v4.3.0" --depth=1 && \
  33. cd toml11 && \
  34. cmake -DCMAKE_CXX_STANDARD=11 . && \
  35. make install -j $THREADS && \
  36. cd .. && \
  37. git clone https://github.com/metacubex/subconverter --depth=1 && \
  38. cd subconverter && \
  39. [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
  40. python3 -m ensurepip && \
  41. python3 -m pip install gitpython && \
  42. python3 scripts/update_rules.py -c scripts/rules_config.conf && \
  43. cmake -DCMAKE_BUILD_TYPE=Release . && \
  44. make -j $THREADS
  45. # build final image
  46. FROM alpine:3.16
  47. LABEL maintainer="[email protected]"
  48. RUN apk add --no-cache --virtual subconverter-deps pcre2 libcurl yaml-cpp
  49. COPY --from=builder /subconverter/subconverter /usr/bin/
  50. COPY --from=builder /subconverter/base /base/
  51. ENV TZ=Africa/Abidjan
  52. RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime
  53. RUN echo $TZ > /etc/timezone
  54. # set entry
  55. WORKDIR /base
  56. CMD subconverter
  57. EXPOSE 25500/tcp