LearnPython/Docker/Dockerfile

67 lines
1.6 KiB
Docker
Raw Permalink Normal View History

2018-05-23 09:59:29 +08:00
# Dockerfile by xianhu: build a docker image
2018-06-07 14:59:54 +08:00
# centos6:
# docker build -t user/centos6 .
# docker run -it --name test [-p -v] user/centos6
# docker attach test
# centos7:
# docker build -t user/centos7 .
# docker run -dt --privileged --name test [-p -v] user/centos7
# docker exec -it test /bin/bash
2017-06-24 16:35:04 +08:00
2018-06-07 14:59:54 +08:00
FROM centos:6.9
2017-06-24 16:35:04 +08:00
MAINTAINER xianhu <qixianhu@qq.com>
# change system environments
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# change system local time
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2017-11-17 22:26:55 +08:00
# fix: warning: rpmts_HdrFromFdno
2017-11-18 19:02:59 +08:00
RUN rpm --import /etc/pki/rpm-gpg/RPM*
2017-11-17 22:26:55 +08:00
2017-06-24 16:35:04 +08:00
# update yum and install something
RUN yum update -y
RUN yum install -y xz
RUN yum install -y vim
RUN yum install -y git
RUN yum install -y gcc
RUN yum install -y make
2017-10-17 10:18:24 +08:00
RUN yum install -y wget
RUN yum install -y screen
2018-05-23 09:59:29 +08:00
RUN yum install -y gcc-c++
2017-10-17 10:18:24 +08:00
RUN yum install -y crontabs
2017-06-24 16:35:04 +08:00
RUN yum install -y zlib-devel
2017-11-17 18:35:59 +08:00
RUN yum install -y sqlite-devel
2017-06-24 16:35:04 +08:00
RUN yum install -y openssl-devel
2017-08-21 17:43:05 +08:00
2018-05-23 09:59:29 +08:00
# install python
2018-06-07 14:59:54 +08:00
RUN yum install -y https://centos6.iuscommunity.org/ius-release.rpm
# RUN yum install -y https://centos7.iuscommunity.org/ius-release.rpm
2018-05-30 14:00:26 +08:00
RUN yum install -y python36u
RUN yum install -y python36u-pip
RUN yum install -y python36u-devel
2018-05-23 09:59:29 +08:00
2017-08-21 17:43:05 +08:00
# install nginx
2018-05-30 14:00:26 +08:00
RUN yum install -y epel-release
2017-08-21 17:43:05 +08:00
RUN yum install -y nginx
# clean yum cache
2017-06-24 16:35:04 +08:00
RUN yum clean all
# install libs of python3
2017-08-21 17:43:05 +08:00
ADD ./requirements.txt /root/
2017-06-24 16:35:04 +08:00
WORKDIR /root/
2018-05-23 09:59:29 +08:00
RUN pip3.6 install --upgrade pip
RUN pip3.6 install -r requirements.txt
2017-07-12 09:55:39 +08:00
# clean everything
2017-06-24 16:35:04 +08:00
RUN rm -rf /root/*
2018-06-07 14:59:54 +08:00
# centos6
CMD /bin/bash
# centos7
# ENTRYPOINT /usr/sbin/init