Skip to content

Commit

Permalink
升级dockerfile 压缩包大小,去除Nginx,nodejs等。 v7.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xianhu committed Sep 22, 2021
1 parent 17e4369 commit a2c31e1
Showing 1 changed file with 33 additions and 47 deletions.
80 changes: 33 additions & 47 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Dockerfile by xianhu: build a docker image
# docker build --rm -t xianhu/centos:v7.8.3 .
# docker build --rm -t xianhu/centos:v7.8.4 .

# 普通进入
# docker run -it --name test [-p -v] xianhu/centos:v7.8.3 (ctrl+p/q即可退出,attach重新进入)
# docker run -it --name test [-p -v] xianhu/centos:v7.8.4 /bin/bash
# docker attach test (ctrl+p/q即可退出,attach重新进入)

# 特权进入
# docker run -it --name test -d [-p -v] --privileged=true xianhu/centos:v7.8.3 /usr/sbin/init
# docker run -it --name test [-p -v] -d --privileged=true xianhu/centos:v7.8.4
# docker exec -it test /bin/bash (不能使用attach进入,退出直接exit即可)

# 基础镜像
Expand All @@ -15,59 +16,44 @@ FROM centos:7.8.2003
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

# fix: warning: rpmts_HdrFromFdno
RUN rpm --import /etc/pki/rpm-gpg/RPM*
# change system local time, fix: warning: rpmts_HdrFromFdno
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
rpm --import /etc/pki/rpm-gpg/RPM*

# 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
RUN yum install -y wget
RUN yum install -y which
RUN yum install -y screen
RUN yum install -y gcc-c++
RUN yum install -y crontabs
RUN yum install -y zlib-devel
RUN yum install -y sqlite-devel
RUN yum install -y openssl-devel
RUN yum install -y bzip2-devel
RUN yum install -y libffi-devel
RUN yum install -y libSM.x86_64
RUN yum install -y libXext.x86_64
RUN yum install -y libXrender.x86_64

# install node
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash -
RUN yum install -y nodejs

# install epel
RUN yum install -y epel-release
RUN yum update -y && \
yum install -y xz \
vim \
git \
gcc \
make \
wget \
which \
screen \
gcc-c++ \
crontabs \
zlib-devel \
sqlite-devel \
openssl-devel \
bzip2-devel \
libffi-devel \
libSM.x86_64 \
libXext.x86_64 \
libXrender.x86_64

# install python
COPY ./Python-3.8.12.tgz /root
WORKDIR /root
COPY ./Python-3.8.12.tgz /root/
WORKDIR /root/
RUN tar xvzf Python-3.8.12.tgz
WORKDIR /root/Python-3.8.12
RUN ./configure
RUN make && make install

# clean root
WORKDIR /root/Python-3.8.12/
RUN ./configure && make && make install
WORKDIR /root/
RUN rm -rf /root/*

# install nginx
RUN yum install -y nginx
# clean root and yum cache
RUN rm -rf /root/* && yum clean all

# clean yum cache
RUN yum clean all
# RUN python3 -m pip install --upgrade pip -i http://pypi.douban.com/simple/
# RUN python3 -m pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/

# entry
CMD /bin/bash
CMD /usr/sbin/init

0 comments on commit a2c31e1

Please sign in to comment.