LoginSignup
1
0

More than 5 years have passed since last update.

【Dockerfile】Debianのコンテナに新しいバージョンのFFmpegを入れたい

Posted at

概要

  • 本記事は自分用メモでございます。
  • debianで素直にaptコマンドでFFmpegをインストールするとバージョンが低いので、新しいバージョンをインストールする。
  • FFmpegの新しいバージョンは脆弱性対応がされているらしい。
    • (別の都合であるぱいんalpineからでびあんdebianに変更することになったなんて言えない・・・)

前提

Dockerファイルの作成

39行目から84行目くらいが今回の内容。その他はRuby on Railsで使うための設定だったので気にしなくて良いです。
FFMPEG_VERSION の部分でFFmpegの好きなバージョンを指定しています。
rubyのバージョンが古い。→→ごめんバージョンアップ対応まだできてない
余分なパッケージも含まれている。→→勉強中でございます精進します

Dockerfile
FROM ruby:2.4

LABEL maintainer="nagait84 <nagai@hanoi.jp>"

# ビルド時の作業ディレクトリ
WORKDIR /app

# 文字コードUTF-8を使用。
ENV LANG C.UTF-8

# bundler インストールパスの指定
# ENV BUNDLE_PATH /app/vendor/bundle
ENV BUNDLE_APP_CONFIG /app/.bundle

# aptコマンドの警告を消す
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS yes

# 必要なパッケージをインストール
# @note 警告が出ます。aptコマンドを&&で繋いでいるため。コマンド数削減のため無視。
RUN apt -y update && \
    apt -y upgrade && \
    apt -y install \
        bash \
        curl \
        git \
        imagemagick \
        libmysql-cil-dev \
        libxml2-dev \
        libxslt1-dev \
        libyaml-dev \
        mysql-client \
        nodejs \
        ruby-dev \
        ruby-json \
        tzdata \
        zlib1g-dev

# ffmpegをインストール。脆弱性対応があるため3系で最新のものを使用。(2019/04/09時点)
# yasm, nasm, x264 など、依存パッケージのインストールが事前に必要らしい
# makeコマンドの際にいくつもwarningが発生している。これも解決するべきでしょうか。→→deprecatedなのでとりまスルーしてます。
RUN apt -y install \
        libass-dev \
        libmp3lame-dev \
        libopus-dev \
        librtmp-dev \
        libtheora-dev \
        libvorbis-dev \
        libvpx-dev \
        libx264-dev \
        libx265-dev \
        nasm \
        x264 \
        x265 \
        yasm && \
    FFMPEG_VERSION=3.4.6 && \
    DIR=$(mktemp -d) && \
    cd ${DIR} && \
    curl -s http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz | tar zxvf - -C . && \
    cd ffmpeg-${FFMPEG_VERSION} && \
    ./configure \
        --enable-version3 \
        --enable-gpl \
        --enable-nonfree \
        --enable-small \
        --enable-libmp3lame \
        --enable-libx264 \
        --enable-libx265 \
        --enable-libvpx \
        --enable-libtheora \
        --enable-libvorbis \
        --enable-libopus \
        --enable-libass \
        --enable-libwebp \
        --enable-librtmp \
        --enable-postproc \
        --enable-avresample \
        --enable-libfreetype \
        --enable-openssl \
        --disable-debug && \
    make && \
    make install && \
    make distclean && \
    rm -rf ${DIR}

# 3001番ポートを指定
EXPOSE 3001

# pumaソケットのnginx接続用マウント
VOLUME /puma_sokets_*******

参考にしたサイト

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0