ffmpeg 镜像制作dockerfile
可用:
registry.cn-hangzhou.aliyuncs.com/baimeidashu-k8s/ffmpegcentos79:v1.1
Dockerfile
FROM centos:centos7.9.2009
MAINTAINER zhaozhiyong "715740383@qq.com"
# 配置国内软件源
RUN curl -s -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \
sed -i -e '/mirrors.cloud.aliyuncs.com/d' \
-e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo && \
curl -s -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
RUN yum -y install ffmpeg
#RUN ffmpeg -version
#CMD ["tail","-f","/etc/hosts"]
构建镜像:
docker build -t registry.cn-hangzhou.aliyuncs.com/baimeidashu-k8s/ffmpegcentos79:v1 --no-cache .
运行容器:
命令阻断:
docker run -d --name ff registry.cn-hangzhou.aliyuncs.com/baimeidashu-k8s/ffmpegcentos79:v1.1 bash -c "tail -f /etc/hosts "
进入容器验证:
docker exec -it ff bash
安装python:
dockerfile:
#FROM centos:7.5.1804
FROM registry.cn-hangzhou.aliyuncs.com/baimeidashu-k8s/ffmpegcentos79:v1.1
MAINTAINER zhaozhiyong <715740383@qq.com>
ENV PATH $PATH:/usr/local/python3/bin/
ENV PYTHONIOENCODING utf-8
#ADD Python-3.11.0.tgz ./
RUN set -ex \
# 替换yum源
&& mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup \
&& curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
&& sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo \
# 安装python依赖库
&& yum makecache \
&& yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make wget \
&& yum clean all \
&& rm -rf /var/cache/yum \
# 下载安装python3
&& wget https://www.python.org/ftp/python/3.9.19/Python-3.9.19.tgz \
&& mkdir -p /usr/local/python3 \
&& tar -zxvf Python-3.9.19.tgz \
&& cd Python-3.9.19 \
&& ./configure --prefix=/usr/local/python3 \
&& make && make install && make clean \
# 修改pip默认镜像源
&& mkdir -p ~/.pip \
&& echo '[global]' > ~/.pip/pip.conf \
&& echo 'index-url = https://mirrors.aliyun.com/pypi/simple' >> ~/.pip/pip.conf \
&& echo 'trusted-host = mirrors.aliyun.com' >> ~/.pip/pip.conf \
&& echo 'timeout = 120' >> ~/.pip/pip.conf \
# 更新pip
&& pip3 install --upgrade pip \
# 安装wheel
&& pip3 install wheel \
# 删除安装包
&& cd .. \
&& rm -rf /Python* \
&& find / -name "*.py[co]" -exec rm '{}' ';' \
# 设置系统时区
&& rm -rf /etc/localtime \
构建:
docker build -t registry.cn-hangzhou.aliyuncs.com/baimeidashu-k8s/pythonffmpeg:v1 --no-cache .
这个过程比较慢, 要等20分钟
上传到仓库,后期就可以随时用了。
上传:
docker push registry.cn-hangzhou.aliyuncs.com/baimeidashu-k8s/pythonffmpeg:v1
欢迎来撩 : 汇总all