fix docker not compiling

This commit is contained in:
Dominic 2024-05-26 11:33:25 +02:00
parent 677c35a6fd
commit 97a7268d4a
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -1,26 +1,23 @@
FROM alpine:3.19 AS builder
RUN apk add --no-cache cargo
RUN mkdir /src
COPY . /src
WORKDIR /src
RUN cargo build --release --no-default-features
# ##############################################
FROM alpine:3.19 FROM alpine:3.19
ARG ffmpeg_ver=7.0 ARG ffmpeg_ver=7.0
RUN mkdir -p /usr/local/src/render_video
COPY LICENSE /usr/local/src/render_video/LICENSE
COPY Cargo.toml /usr/local/src/render_video/Cargo.toml
COPY Cargo.lock /usr/local/src/render_video/Cargo.lock
COPY src /usr/local/src/render_video/src
COPY assets /usr/local/src/render_video/assets
RUN apk add --no-cache \ RUN apk add --no-cache \
dav1d fontconfig freetype harfbuzz librsvg libva lilv-libs opus svt-av1 x264-libs x265 \ dav1d fontconfig freetype harfbuzz librsvg libva lilv-libs opus svt-av1 x264-libs x265 \
font-noto inkscape libarchive-tools libgcc \ font-noto inkscape libarchive-tools libgcc \
# we install ffmpeg ourselves to get libsvtav1 support which is not part of the alpine package \
&& apk add --no-cache --virtual .build-deps \ && apk add --no-cache --virtual .build-deps \
build-base \ build-base cargo pkgconf \
dav1d-dev fontconfig-dev freetype-dev harfbuzz-dev librsvg-dev libva-dev lilv-dev opus-dev svt-av1-dev x264-dev x265-dev \ dav1d-dev fontconfig-dev freetype-dev harfbuzz-dev librsvg-dev libva-dev lilv-dev opus-dev svt-av1-dev x264-dev x265-dev \
# build the render_video project
&& cargo install --path /usr/local/src/render_video --root /usr/local --no-default-features \
# we install ffmpeg ourselves to get libsvtav1 support which is not part of the alpine package \
&& wget -q https://ffmpeg.org/releases/ffmpeg-${ffmpeg_ver}.tar.bz2 \ && wget -q https://ffmpeg.org/releases/ffmpeg-${ffmpeg_ver}.tar.bz2 \
&& tar xfa ffmpeg-${ffmpeg_ver}.tar.bz2 \ && tar xfa ffmpeg-${ffmpeg_ver}.tar.bz2 \
&& cd ffmpeg-${ffmpeg_ver} \ && cd ffmpeg-${ffmpeg_ver} \
@ -63,6 +60,5 @@ RUN apk add --no-cache \
&& install -Dm644 -t /usr/share/licenses/msfonts/ Licen.TXT \ && install -Dm644 -t /usr/share/licenses/msfonts/ Licen.TXT \
&& cd .. \ && cd .. \
&& rm -r msfonts webfonts.tar.gz && rm -r msfonts webfonts.tar.gz
COPY --from=builder /src/target/release/render_video /usr/local/bin/render_video
ENTRYPOINT ["/usr/local/bin/render_video"] ENTRYPOINT ["/usr/local/bin/render_video"]