Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. FROM node:18-bullseye AS web
  2. WORKDIR /ui
  3. COPY ui/package*.json ./
  4. RUN yarn install
  5. COPY ui ./
  6. ENV NODE_OPTIONS=--openssl-legacy-provider
  7. RUN yarn run build
  8. FROM debian:bullseye AS ffmpeg
  9. ARG DEBIAN_FRONTEND=noninteractive
  10. WORKDIR /static
  11. ARG TARGETPLATFORM
  12. RUN echo ${TARGETPLATFORM}
  13. RUN apt update && \
  14. apt install -y --no-install-recommends wget unzip tar ca-certificates xz-utils
  15. RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
  16. wget https://github.com/Dusk-Labs/ffmpeg-static/releases/download/ffmpeg-all-0.0.1/ffmpeg && \
  17. wget https://github.com/Dusk-Labs/ffmpeg-static/releases/download/ffmpeg-all-0.0.1/ffprobe && \
  18. ls -la . && \
  19. pwd \
  20. ; fi
  21. RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
  22. wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz && \
  23. tar --strip-components 1 -xf ffmpeg-release-arm64-static.tar.xz \
  24. ; fi
  25. RUN if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
  26. wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-armhf-static.tar.xz && \
  27. tar --strip-components 1 -xf ffmpeg-release-armhf-static.tar.xz \
  28. ; fi
  29. RUN chmod +x /static/ffmpeg && chmod +x /static/ffprobe
  30. FROM rust:bullseye AS dim
  31. ARG DEBIAN_FRONTEND=noninteractive
  32. RUN apt-get update && apt-get install -y \
  33. libva-dev \
  34. libva-drm2 \
  35. libva2 \
  36. sqlite3
  37. WORKDIR /dim
  38. COPY . ./
  39. COPY --from=web /ui/build ui/build
  40. ARG DATABASE_URL="sqlite://dim_dev.db"
  41. # Sometimes we may need to quickly build a test image
  42. ARG RUST_BUILD=release
  43. RUN if [ "$RUST_BUILD" = "debug" ]; then \
  44. cargo build --features vaapi && \
  45. mv ./target/debug/dim ./target/dim \
  46. ; fi
  47. RUN if [ "$RUST_BUILD" = "release" ]; then \
  48. cargo build --features vaapi --release && \
  49. mv ./target/release/dim ./target/dim \
  50. ; fi
  51. FROM debian:bullseye
  52. ENV RUST_BACKTRACE=full
  53. ENV DEBIAN_FRONTEND=noninteractive
  54. RUN apt-get update && apt-get install -y \
  55. ca-certificates \
  56. libfontconfig \
  57. libfribidi0 \
  58. libharfbuzz0b \
  59. libtheora0 \
  60. libva-drm2 \
  61. libva2 \
  62. libvorbis0a \
  63. libvorbisenc2 \
  64. && rm -rf /var/lib/apt/lists/*
  65. COPY --from=ffmpeg /static/ffmpeg /opt/dim/utils/ffmpeg
  66. COPY --from=ffmpeg /static/ffprobe /opt/dim/utils/ffprobe
  67. COPY --from=dim /dim/target/dim /opt/dim/dim
  68. EXPOSE 8000
  69. VOLUME ["/opt/dim/config"]
  70. ENV RUST_LOG=info
  71. WORKDIR /opt/dim
  72. CMD ["./dim"]