Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
LM-Firefly committed Dec 21, 2024
1 parent 7ce5da1 commit 39280cf
Showing 1 changed file with 53 additions and 51 deletions.
104 changes: 53 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
FROM alpine:latest
# FROM fireflylzh/subconverter:latest
# FROM alpine:latest
FROM ghcr.io/lm-firefly/subconverter:latest
LABEL maintainer="firefly.lzh@gmail.com"
# ADD https://github.com/LM-Firefly/subconverter/commits/main.atom cache_bust
ARG THREADS="4"
# ARG THREADS="4"
# ARG SHA=""

# build minimized
WORKDIR /
RUN set -xe && \
apk add tzdata && ls /usr/share/zoneinfo && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && date && apk del tzdata && \
apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 && \
apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev && \
git clone https://github.com/ftk/quickjspp --depth=1 && \
cd quickjspp && \
git submodule update --init && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make quickjs -j $THREADS && \
install -d /usr/lib/quickjs/ && \
install -m644 quickjs/libquickjs.a /usr/lib/quickjs/ && \
install -d /usr/include/quickjs/ && \
install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/ && \
install -m644 quickjspp.hpp /usr/include && \
cd .. && \
git clone https://github.com/PerMalmberg/libcron --depth=1 && \
cd libcron && \
git submodule update --init && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make libcron -j $THREADS && \
install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
install -d /usr/include/libcron/ && \
install -m644 libcron/include/libcron/* /usr/include/libcron/ && \
install -d /usr/include/date/ && \
install -m644 libcron/externals/date/include/date/* /usr/include/date/ && \
cd .. && \
git clone https://github.com/ToruNiina/toml11 --branch="v3.8.1" --depth=1 && \
cd toml11 && \
cmake -DCMAKE_CXX_STANDARD=11 . && \
make install -j $THREADS && \
cd .. && \
git clone https://github.com/LM-Firefly/subconverter --depth=1 && \
cd subconverter && \
# [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
time=$(date +%y.%m%d.%H%M-) && sha=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$time$sha"'/' src/version.h && \
sed -i 's/cloudflare_analytics_token/53df9c68f0664efaa935363dac7c0e2b/' base/sub-web/index.html && \
# python3 -m ensurepip && \
# python3 -m pip install gitpython && \
# python3 scripts/update_rules.py -c scripts/rules_config.conf && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make -j $THREADS && \
mv subconverter /usr/bin && \
mv base ../ && \
cd .. && \
rm -rf subconverter quickjspp libcron toml11 /usr/lib/lib*.a /usr/include/* /usr/local/include/lib*.a /usr/local/include/* && \
apk add --no-cache --virtual subconverter-deps pcre2 libcurl yaml-cpp libevent && \
apk del .build-tools .build-deps
#WORKDIR /
#RUN set -xe && \
# apk add tzdata && ls /usr/share/zoneinfo && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && date && apk del tzdata && \
# apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 && \
# apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev && \
# git clone https://github.com/ftk/quickjspp --depth=1 && \
# cd quickjspp && \
# git submodule update --init && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make quickjs -j $THREADS && \
# install -d /usr/lib/quickjs/ && \
# install -m644 quickjs/libquickjs.a /usr/lib/quickjs/ && \
# install -d /usr/include/quickjs/ && \
# install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/ && \
# install -m644 quickjspp.hpp /usr/include && \
# cd .. && \
# git clone https://github.com/PerMalmberg/libcron --depth=1 && \
# cd libcron && \
# git submodule update --init && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make libcron -j $THREADS && \
# install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
# install -d /usr/include/libcron/ && \
# install -m644 libcron/include/libcron/* /usr/include/libcron/ && \
# install -d /usr/include/date/ && \
# install -m644 libcron/externals/date/include/date/* /usr/include/date/ && \
# cd .. && \
# git clone https://github.com/ToruNiina/toml11 --branch="v3.8.1" --depth=1 && \
# cd toml11 && \
# cmake -DCMAKE_CXX_STANDARD=11 . && \
# make install -j $THREADS && \
# cd .. && \
# git clone https://github.com/LM-Firefly/subconverter --depth=1 && \
# cd subconverter && \
## [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
# time=$(date +%y.%m%d.%H%M-) && sha=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$time$sha"'/' src/version.h && \
# sed -i 's/cloudflare_analytics_token/53df9c68f0664efaa935363dac7c0e2b/' base/sub-web/index.html && \
## python3 -m ensurepip && \
## python3 -m pip install gitpython && \
## python3 scripts/update_rules.py -c scripts/rules_config.conf && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make -j $THREADS && \
# mv subconverter /usr/bin && \
# mv base ../ && \
# cd .. && \
# rm -rf subconverter quickjspp libcron toml11 /usr/lib/lib*.a /usr/include/* /usr/local/include/lib*.a /usr/local/include/* && \
# apk add --no-cache --virtual subconverter-deps pcre2 libcurl yaml-cpp libevent && \
# apk del .build-tools .build-deps

## build final image
#FROM alpine:latest
Expand All @@ -64,7 +64,9 @@ RUN set -xe && \
#COPY --from=builder /subconverter/subconverter /usr/bin/
#COPY --from=builder /subconverter/base /base/

WORKDIR /
COPY base/ /base/
RUN sed -i 's/cloudflare_analytics_token/53df9c68f0664efaa935363dac7c0e2b/g' /base/sub-web/index.html

# set entry
WORKDIR /base
Expand Down

0 comments on commit 39280cf

Please sign in to comment.