Fixed dockerfile
This commit is contained in:
@@ -11,36 +11,51 @@ COPY Cargo.toml ./
|
|||||||
RUN apt-get update && apt-get install -y cmake
|
RUN apt-get update && apt-get install -y cmake
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
# # ==========
|
# ==========
|
||||||
# # Packages
|
# Packages
|
||||||
# # ==========
|
# ==========
|
||||||
# FROM debian:bullseye-slim as packages
|
FROM debian:bookworm-slim as packages
|
||||||
# # FROM debian:bookworm-slim as packages
|
WORKDIR /packages
|
||||||
# WORKDIR /packages
|
|
||||||
|
|
||||||
# RUN apt-get update && apt-get install -y curl tar xz-utils && \
|
RUN apt-get update && apt-get install -y curl tar xz-utils
|
||||||
# curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && \
|
ARG TARGETPLATFORM
|
||||||
# # curl -L https://github.com/yt-dlp/yt-dlp/releases/download/2023.07.06/yt-dlp_linux > yt-dlp && \
|
# Check if the target platform is linux/x86_64, otherwise log error and exit
|
||||||
# chmod +x yt-dlp && \
|
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||||
# curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
echo "amd64" && false; \
|
||||||
# # curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/autobuild-2023-06-30-14-08/ffmpeg-N-111310-g96d6990517-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
||||||
# tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_armv7l > yt-dlp && \
|
||||||
|
chmod +x yt-dlp; \
|
||||||
|
elif [ "$TARGETPLATFORM" = "linux/aarch64" ]; then \
|
||||||
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_aarch64 > yt-dlp && \
|
||||||
|
chmod +x yt-dlp; \
|
||||||
|
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
||||||
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_aarch64 > yt-dlp && \
|
||||||
|
chmod +x yt-dlp && \
|
||||||
|
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||||
|
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \
|
||||||
|
elif [ "$TARGETPLATFORM" = "linux/x86_64" ]; then \
|
||||||
|
echo "Unsupported platform: $TARGETPLATFORM" && \
|
||||||
|
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && \
|
||||||
|
chmod +x yt-dlp && \
|
||||||
|
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||||
|
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz; \
|
||||||
|
else \
|
||||||
|
echo "Unsupported platform: $TARGETPLATFORM" && false; \
|
||||||
|
fi
|
||||||
|
|
||||||
# =========
|
# =========
|
||||||
# Runtime
|
# Runtime
|
||||||
# =========
|
# =========
|
||||||
# FROM debian:bullseye-slim as runtime
|
|
||||||
FROM debian:bookworm-slim as runtime
|
FROM debian:bookworm-slim as runtime
|
||||||
WORKDIR /service
|
WORKDIR /service
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
COPY --from=builder /builder/target/release/service /usr/local/bin/service
|
COPY --from=builder /builder/target/release/service /usr/local/bin/service
|
||||||
# COPY --from=packages /packages /usr/bin
|
COPY --from=packages /packages /usr/bin
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
libc6 libc6-dev libopus-dev libpq5 libpq-dev python3-pip ffmpeg pipx
|
libc6 libc6-dev libopus-dev libpq5 libpq-dev python3-pip ffmpeg
|
||||||
# apt-get auto-remove -y && \
|
# apt-get auto-remove -y && \
|
||||||
# pip install -U yt-dlp
|
# RUN pipx install yt-dlp
|
||||||
RUN pipx install yt-dlp
|
|
||||||
|
|
||||||
CMD ["service"]
|
CMD ["service"]
|
||||||
|
|||||||
Reference in New Issue
Block a user