All checks were successful
Build and Push Multi-Arch Docker Image / build-and-push (push) Successful in 18m28s
needs check, if converted files can be run on device Signed-off-by: Peter Siegmund <developer@mars3142.org>
41 lines
1.2 KiB
Docker
41 lines
1.2 KiB
Docker
# Use latest stable channel SDK.
|
|
FROM dart:stable AS build
|
|
|
|
# Resolve app dependencies.
|
|
WORKDIR /app
|
|
COPY pubspec.* ./
|
|
RUN dart pub get
|
|
|
|
# Copy app source code (except anything in .dockerignore) and AOT compile app.
|
|
COPY . .
|
|
RUN dart run build_runner build --delete-conflicting-outputs && \
|
|
APP_VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //') && \
|
|
dart compile exe bin/server.dart -o bin/server \
|
|
-DAPP_VERSION=$APP_VERSION
|
|
|
|
# Build minimal serving image with ffmpeg and yt-dlp
|
|
FROM debian:stable-slim
|
|
|
|
# Install ffmpeg and download yt-dlp binary
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
ca-certificates \
|
|
curl \
|
|
&& curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
|
|
&& chmod a+rx /usr/local/bin/yt-dlp \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=build /app/bin/server /app/bin/
|
|
COPY assets /assets
|
|
|
|
# Create startup script for yt-dlp update and 24h restart
|
|
RUN echo '#!/bin/sh\nyt-dlp -U 2>/dev/null || true\n(sleep 86400 && kill 1) &\nexec /app/bin/server' > /app/start.sh \
|
|
&& chmod +x /app/start.sh
|
|
|
|
WORKDIR /app
|
|
|
|
# Start server.
|
|
EXPOSE 3000
|
|
CMD ["/app/start.sh"]
|