The Jexus + mono and sites together packaged docker mirrored by Dockerfile

Last use of container docker docker run others packaged mirror, Wang Libian accession, the final asp.net.

The decision to direct a new package jexus + asp.net website docker package.

 Into the root directory, and create a name for the directory in the root directory as the base directory docker time we packed items.

#cd /root
#mkdir docker
#cd docker

First prepare .Net operating environment, download jexus, download jexus Pro 5.8.3, which already contains the Mono .Net version of Linux is running, do not need to install additional configuration Mono, relatively easy.

wget https://www.linuxdot.net/down/jexus-5.8.3-x64.tar.gz

Then prepare the site directory, wwwroot, the web directory cp to the current directory.

jexus configuration file located in the jexus / siteconf directory named default.

The root of the site's default / var / www / default, we are here to root directory of the site is set to / var / www / wwwroot, it is necessary to modify the configuration file.

Other modifications, such as custom-configured:. URL rewriting rewrite = / News / ([(af) | (AF) | (0-9)] {12}) \ aspx /News/News.aspx?type=0& ; id = $ 1, etc.

Multiple URL rewriting to rewrite on the use of multiple, one per line.

Operating environment, configuration files, website directories are, and the rest is written in the main event, Dockerfile file.

Write complete code is as follows:

#base image
FROM centos

# MAINTAINER
MAINTAINER li.chao@163.com

# put jexus-5.8.3-x64.tar.gz into /usr and unpack jexus
ADD jexus-5.8.3-x64.tar.gz /usr/

# overwrite jexus config file  into /usr/jexus/siteconf/
COPY default /usr/jexus/siteconf/

# put webroot
COPY webroot /var/www/webroot

# running required command install required fonts
RUN yum install -y dejavu-fonts-common dejavu-lgc-sans-mono-fonts

# change dir to /usr/jexus
WORKDIR /usr/jexus

EXPOSE 80

The official centos mirror to mirror as the base image. The following operations are sequentially performed.

# The jexus the decompressed packet to the container / usr / directory 
the ADD-jexus 5.8.3 -x64.tar.gz / usr / 

# jexus cover profile / usr / jexus / siteconf / default, 
COPY default / usr / jexus / siteconf / 
 # copied to the mirror site root  cOPY Webroot / var / WWW / Webroot 
 operation # running the installation dependencies, there is installed fonts, this font will not result in error codes.  RUN yum -y install the Common-dejavu dejavu-Fonts-LGC-Sans-Mono-Fonts # set the working directory to / usr / jexus WORKDIR / usr / jexus 
# output port is set to 80 EXPOSE 80

This process can in fact be further reduced, as advance jexus decompression, and modify the configuration files, so you can cancel the ADD, instead of using cOPY, and can be omitted from the process of copying a separate configuration files, and even jexus webroot into the same directory, you only need to copy once
here, in order to make the process clear and easy to read the file, separated East Columbia steps.
After the file is saved, the files in the following directory docker

ll

 Then run Packager

#docker build -t centos_jexus:v1 .

Note finally have a point, do not lose. After running

Complete package:

Run the Mirror

 

success! Site visits everything is normal!

(后记:由于该服务器需要对多个网站提供服务,因此不能允许某个网站独占80端口,因此在服务器上安装了Nginx,然后使用虚拟主机配置文件,将不同网站按照域名分别重定向到本地不同的端口,最终实现了多个虚拟主机。且各个虚拟主机可以分I别运行与不同的Docker上)

 

Guess you like

Origin www.cnblogs.com/Ricklee/p/11374747.html