Stripped out ui/api
This commit is contained in:
68
Dockerfile
Normal file
68
Dockerfile
Normal file
@@ -0,0 +1,68 @@
|
||||
# =========
|
||||
# Builder
|
||||
# =========
|
||||
FROM rust:bookworm as builder
|
||||
WORKDIR /builder
|
||||
|
||||
COPY migrations ./migrations
|
||||
COPY src ./src
|
||||
COPY Cargo.toml ./
|
||||
|
||||
RUN apt-get update && apt-get install -y cmake
|
||||
RUN cargo build --release
|
||||
|
||||
# ======
|
||||
# Keys
|
||||
# ======
|
||||
FROM debian:bookworm-slim as keys
|
||||
WORKDIR /keys
|
||||
|
||||
RUN apt-get update && apt-get install -y openssl libpq-dev
|
||||
RUN openssl genrsa -out private_key.pem 4096
|
||||
RUN openssl rsa -in private_key.pem -pubout -outform PEM -out public_key.pem
|
||||
RUN chmod 600 private_key.pem
|
||||
RUN chmod 644 public_key.pem
|
||||
|
||||
# ==========
|
||||
# Packages
|
||||
# ==========
|
||||
FROM debian:bookworm-slim as packages
|
||||
WORKDIR /packages
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN apt-get update && apt-get install -y curl tar xz-utils && \
|
||||
if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
||||
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" ] | [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||
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
|
||||
# =========
|
||||
FROM debian:bookworm-slim as runtime
|
||||
WORKDIR /service
|
||||
USER root
|
||||
|
||||
COPY --from=builder /builder/target/release/service /usr/local/bin/service
|
||||
COPY --from=packages /packages /usr/bin
|
||||
COPY --from=keys /keys /keys
|
||||
|
||||
RUN apt-get update && apt-get install -y libc6 libc6-dev libopus-dev libpq5 libpq-dev python3-pip ffmpeg
|
||||
|
||||
CMD ["service"]
|
||||
Reference in New Issue
Block a user