-
Notifications
You must be signed in to change notification settings - Fork 77
/
Dockerfile
54 lines (44 loc) · 2.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM rust:buster as builder-gifski
RUN cargo install --version 1.32.0 gifski
FROM gcc:13 as builder-lottie-to-png
RUN apt update && \
apt install --assume-yes cmake python3 python3-pip && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install --break-system-packages conan==2.0.10
WORKDIR /application
RUN conan profile detect
COPY conanfile.txt .
RUN conan install . --build=missing -s build_type=Release
COPY CMakeLists.txt .
COPY src src
RUN cmake -DCMAKE_BUILD_TYPE=Release -DLOTTIE_MODULE=OFF CMakeLists.txt && cmake --build . --config Release
FROM debian:buster-slim as lottie-to-gif
COPY --from=builder-gifski /usr/local/cargo/bin/gifski /usr/bin/gifski
COPY --from=builder-lottie-to-png /application/bin/lottie_to_png /usr/bin/lottie_to_png
COPY bin/lottie_common.sh /usr/bin
COPY bin/lottie_to_gif.sh /usr/bin
CMD bash -c "\
find /source -type f \( -iname \*.json -o -iname \*.lottie -o -iname \*.tgs \) | while IFS=$'\n' read -r FILE; do \
echo Converting \${FILE}... && lottie_to_\${FORMAT}.sh \${WIDTH:+--width \$WIDTH} \${HEIGHT:+--height \$HEIGHT} \${FPS:+--fps \$FPS} \${QUALITY:+--quality \$QUALITY} \$FILE && echo Done.; \
done\
"
ENV FORMAT=gif
FROM alpine:3.16.2 as builder-lottie-to-some
COPY --from=builder-lottie-to-png /application/bin/lottie_to_png /usr/bin/lottie_to_png
COPY bin/* /usr/bin/
CMD sh -c "\
find /source -type f \( -iname \*.json -o -iname \*.lottie -o -iname \*.tgs \) | while IFS=$'\n' read -r FILE; do \
echo Converting \${FILE}... && lottie_to_\${FORMAT}.sh \${WIDTH:+--width \$WIDTH} \${HEIGHT:+--height \$HEIGHT} \${FPS:+--fps \$FPS} \${QUALITY:+--quality \$QUALITY} \$FILE && echo Done.; \
done\
"
FROM builder-lottie-to-some as builder-lottie-to-ffmpegable
RUN apk --no-cache add ffmpeg
FROM builder-lottie-to-ffmpegable as lottie-to-apng
ENV FORMAT=apng
FROM builder-lottie-to-ffmpegable as lottie-to-webm
ENV FORMAT=webm
FROM builder-lottie-to-some as lottie-to-png
ENV FORMAT=png
FROM builder-lottie-to-some as lottie-to-webp
RUN apk --no-cache add libwebp-tools
ENV FORMAT=webp