Production docker service of Mirror 2

Production aphine Mirror

aphine official website: https: //www.alpinelinux.org/

1, the source of the replacement aphine

$ docker run -it -p 8801:80 alpine:latest sh  #aphine没有bash环境,只能sh启动

$ vi /etc/apk/repositories

https://mirrors.aliyun.com/alpine/v3.10/community/
https://mirrors.aliyun.com/alpine/v3.10/main/

2, dependent software installation

apk update

apk add iotop gcc libgcc libc-dev libcurl libc-utils libnfs make pcre pcre2 zip unzip net-tools pstree wget libevent libeve
nt-dev iproute2

3, compile and install nginx

$ cd /opt
$  wget http://nginx.org/download/nginx-1.16.1.tar.gz
$ cd nginx-1.16.1/
$ ./configure --prefix=/apps/nginx  && make && make install
$ addgroup -g 2019 -S  nginx
$   adduser -s /sbin/nologin -S -D -u 2019 -G nginx nginx
$  vi conf/nginx.conf
$  mkdir /data/nginx/html/linux37 -pv
$ chown -R nginx.nginx /data/nginx /apps/nginx
$ ln -sv /apps/nginx/sbin/nginx /usr/bin/

aphine need to store files:

root@docker-node1:/opt/dockerfile/system/aphine# ls
 bulid-command.sh  Dockerfile  linux37.tar.gz  nginx-1.16.1.tar.gz  nginx.conf  repositories

Construction of Dockerfile


FROM alpine
  
maintainer pansn "www.pansn.cn"

COPY repositories /etc/apk/repositories
RUN apk update && apk add iotop gcc libgcc libc-dev libcurl libc-utils libnfs make pcre pcre2 zip unzip net-tools pstree wget libevent libevent-dev iproute2 pcre-dev zlib-dev

#安装编译nginx
ADD nginx-1.16.1.tar.gz /opt/
RUN cd /opt/nginx-1.16.1 && ./configure --prefix=/apps/nginx && make && make install
RUN addgroup -g 2019 -S  nginx && adduser -s /sbin/nologin -S -D -u 2019 -G nginx nginx &&  mkdir /data/nginx/html/linux37 -pv

COPY nginx.conf /apps/nginx/conf/nginx.conf
ADD  linux37.tar.gz /data/nginx/html
RUN  chown -R nginx.nginx /data/nginx /apps/nginx && ln -sv /apps/nginx/sbin/nginx /usr/bin/


EXPOSE 80 443

CMD ["nginx"]

Guess you like

Origin www.cnblogs.com/pansn/p/11528145.html