# 基礎鏡像版本 必須步驟
FROM ubuntu
# 作者信息
MAINTAINER king
# 將需要的安裝包和文件添加到容器(可以的話,配置文件提前修改好!) 必須步驟
ADD ElecManageSystem /mnt/ElecManageSystem
ADD Tools /mnt
# 安裝wget
#RUN apt-get -y -q install wget
# 添加apt-get源
#RUN wget -q http://download.opensuse.org/repositories/home:tpokorra:mono/xUbuntu_12.04/Release.key -O- | apt-key add -
# 卸載wget
#RUN apt-get remove -y --auto-remove wget
# 添加openSUSE的鏡像源列表
#RUN sh -c "echo 'deb http://download.opensuse.org/repositories/home:/tpokorra:/mono/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/mono-opt.list"
# 安裝mono,安裝前需要升級apt-get 必須步驟
RUN apt-get update
#RUN apt-get -q install mono-opt#
#安裝make 必須步驟
RUN apt-get -y install make
#安裝gcc和gcc-c++ 必須步驟
RUN apt-get -y install gcc
RUN apt-get -y install g++
# 安裝vim 必須步驟
# RUN apt-get -y install vim
# 安裝的內容較多,包含gcc
# RUN apt-get -y install build-essential
# 安裝yum
# RUN apt-get -y install yum
# 安裝pcre,必須步驟。進入/esr/mnt/
#RUN cd /usr/mnt/
# 下載
#RUN wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
# 解壓文件
#RUN tar -zxvf pcre-8.38.tar.gz
# 進入解壓后的文件夾
#RUN cd pcre-8.38
# 生成makefile
#RUN ./configure
# 編譯
#RUN make
# 安裝
#RUN make install
# 避免error: the HTTP rewrite module requires the PCRE library 必須步驟
RUN apt-get install libpcre3 libpcre3-dev
# 安裝zlib庫 必須步驟
#RUN cd /usr/mnt/
#RUN wget http://zlib.net/zlib-1.2.8.tar.gz
#RUN tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8
#RUN ./configure
#RUN make
#RUN make install
# 安裝openssl
#RUN cd /opt
#RUN wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
#RUN tar -zxvf openssl-1.0.1c.tar.gz
#RUN ./config
#RUN make
#RUN rm /usr/bin/pod2man
#RUN make install
# 安裝Nginx 必須步驟
#Nginx 一般有兩個版本,分別是穩定版和開發版,您可以根據您的目的來選擇這兩個版本的其中一個,下面是把 Nginx 安裝到 /usr/local/nginx 目錄下的詳細步驟:
#RUN cd /usr/local/
#RUN wget http://nginx.org/download/nginx-1.2.8.tar.gz
#RUN tar -zxvf nginx-1.2.8.tar.gz
#RUN cd nginx-1.2.8
#RUN ./configure --prefix=/usr/local/nginx
#RUN make
#RUN make install
# 安裝完Nginx后,如果是32位系統
# RUN ln -s /usr/local/lib/libpcre.so.1 /lib
# 如果是64位系統
# RUN ln -s /usr/local/lib/libpcre.so.1 /lib64
# 映射端口並啟動容器,開啟nginx 必須步驟
docker run -i -p 1314:80 -t DockerImage
/usr/local/nginx/sbin/nginx
# 如需重啟Nginx
/usr/local/nginx/sbin/nginx -s reload
# Nginx.conf文件模板如下:
FROM ubuntu MAINTAINER king ADD Tools /opt RUN apt-get -y update RUN apt-get -y install make RUN apt-get -y install gcc RUN apt-get -y install g++ RUN apt-get -y install libpcre3 libpcre3-dev
進入容器后安裝vim、pcre、zlib、openssl、nginx
然后移動web應用文件夾到/usr/local/nginx/html下,把web應用文件夾下的其他文件夾都移動到app下。
配置nginx.conf,其中 root html/ElecManageSystem/app 放到server下,而不是location下。
啟動nginx,/usr/local/nginx/sbin/nginx
重啟nginx,/usr/local/nginx/sbin/nginx -s reload