rabin 9 months ago
parent
commit
a04abb7ad0

+ 1 - 1
container/conf/web/php7/conf.d/00_zip.ini

@@ -1,2 +1,2 @@
 extension=zip.so
-extension=yaconf.so
+#extension=yaconf.so

+ 18 - 0
src/docker/build/dev/php/v8/Dockerfile

@@ -0,0 +1,18 @@
+FROM docker.dever.cc/os/alpine:latest
+
+MAINTAINER Rabin "https://github.com/shemic"
+
+ENV COMPOSER_HOME=/share/lib/php
+
+RUN apk add --no-cache --update curl php83-fpm php83-pear php83-mysqli php83-session php83-pgsql php83-pdo_mysql php83-pdo_pgsql php83-gd php83-curl php83-json php83-zlib php83-xml php83-xmlwriter php83-iconv php83-zip php83-phar  php83-openssl php83-dom php83-mbstring php83-simplexml php83-sockets php83-pcntl php83-fileinfo  php83-tokenizer php83-opcache php83-posix php83-ctype php-pecl-imagick && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/bin/composer && apk del curl && composer config -g repo.packagist composer https://packagist.phpcomposer.com
+
+#php83-memcached php83-redis php-pecl-imagick
+
+COPY php.sh /entrypoint/php.sh
+COPY install.sh /install.sh
+
+VOLUME ["/www", "/etc/php83"]
+
+EXPOSE 9000
+
+CMD ["php"]

BIN
src/docker/build/dev/php/v8/composer.phar


+ 24 - 0
src/docker/build/dev/php/v8/install.sh

@@ -0,0 +1,24 @@
+#!/usr/bin/env sh
+set -e
+lib="php83-dev m4 autoconf gcc g++ make openssl-dev curl wget"
+apk add --no-cache --update $lib
+if [ -n "$3" ];then
+	rely=$3
+    apk add --no-cache --update ${rely//,/" "}
+fi
+curl -O http://pecl.php.net/get/$1.tgz
+tar -xzvf $1.tgz
+rm -rf $1.tgz
+cd $1
+phpize
+if [ -n "$4" ];then
+	config=$4
+	./configure --with-php-config=/usr/bin/php-config ${config//,/" "}
+else
+	./configure --with-php-config=/usr/bin/php-config
+fi
+make
+make install
+echo extension=$2.so > /etc/php7/conf.d/10_$2.ini
+#killall -9 php-fpm7 && php-fpm7
+#apk del $lib

+ 22 - 0
src/docker/build/dev/php/v8/php.sh

@@ -0,0 +1,22 @@
+#!/usr/bin/env sh
+set -e
+PHP="php-fpm83"
+start_php()
+{
+	# 使用exec 将替换主进程,信号检测将失效,无法执行end_php
+	#exec php-fpm
+	process_start $PHP
+	process_start crond
+}
+
+stop_php()
+{
+	process_stop $PHP
+	process_stop crond
+}
+
+monit_php()
+{
+	process_monit $PHP
+	process_monit crond
+}

+ 1 - 1
src/docker/build/os/alpine/Dockerfile

@@ -1,5 +1,5 @@
 #FROM alpine:3.6
-FROM alpine:3.17
+FROM alpine
 
 MAINTAINER Rabin "https://github.com/shemic"
 

+ 14 - 2
src/docker/build/os/ubuntu/Dockerfile

@@ -1,5 +1,17 @@
-FROM daocloud.io/library/ubuntu:16.04
+FROM daocloud.io/library/ubuntu
 
 MAINTAINER Rabin "https://github.com/shemic"
 
-RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.163.com/g" /etc/apt/sources.list && apt-get update -y && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install git tar vim-nox net-tools wget --no-install-recommends && apt-get clean  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.163.com/g" /etc/apt/sources.list && apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get -y install bash git tar vim-nox net-tools wget --no-install-recommends && apt-get clean  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+
+RUN mv /bin/sh /bin/sh-old && ln -s /bin/bash /bin/sh
+
+VOLUME ["/share"]
+
+COPY entrypoint.sh /entrypoint.sh
+COPY process.sh /entrypoint/process.sh
+
+RUN chmod +x /entrypoint.sh
+RUN chmod +x /entrypoint/process.sh
+
+#ENTRYPOINT ["/entrypoint.sh"]

+ 138 - 0
src/docker/build/os/ubuntu/entrypoint.sh

@@ -0,0 +1,138 @@
+#!/usr/bin/env sh
+set -e
+hosts()
+{
+    if [ `id -u` -eq 0 ];then
+        host="/etc/hosts.main"
+        yes="/etc/hosts.yes"
+        if [ ! -s "$yes" ]; then
+            if [ -s "$host" ]; then
+                while read line
+                do
+                echo $line >> /etc/hosts
+                done < $host
+                echo "yes" > $yes
+            fi
+        fi
+    fi
+}
+get_ip()
+{
+    ip=`ifconfig|grep "inet addr:$1"|awk -F":" '{print $2}'|awk '{print $1}'`
+
+    echo $ip
+}
+get_ip_eth()
+{
+    check=`ifconfig|grep $1`
+    if [ "$check" != "" ]; then
+        ip=`ifconfig $1|grep "inet addr:"|awk -F":" '{print $2}'|awk '{print $1}'`
+    else
+        ip=`ifconfig eth0|grep "inet addr:"|awk -F":" '{print $2}'|awk '{print $1}'`
+    fi
+
+    echo $ip
+}
+process()
+{
+    echo "$1 Startup Completed" > /share/process/$1
+}
+check()
+{
+    path="process"
+    if [ -n "$2" ];then
+        path="$2"
+    fi
+    process="/share/$path/$1"
+    while [ ! -s "$process" ]; do
+        true
+    done
+}
+share()
+{
+    path=/share/lib/$2
+    if [ ! -d "$path" ]; then  
+        mkdir -p "$path"
+    fi
+    cp -R $1/* $path
+}
+hadoop_mkdir()
+{
+    dir=$(hadoop fs -ls / | grep $1 | wc -l)
+    if [ $dir -eq 0 ] ;then
+        for i in $@
+        do
+            hadoop fs -mkdir -p /$i
+        done
+    fi
+}
+load()
+{
+    dir=/entrypoint/
+    loop=$(ls -l $dir |awk '{print $9}')
+    for i in $loop
+    do
+        source $dir$i
+    done
+}
+define()
+{
+    state=1
+    type $1 >/dev/null ||
+    {
+        state=2
+    }
+    echo $state
+}
+start()
+{
+    if [ -n "$1" ];then
+        start="start_$@"
+        state=`define $start`
+        if [ $state = 1 ];then
+            echo $start > /process
+            status=`$start`
+            echo $status
+            netstat -apn
+            process $1
+        fi
+    fi
+}
+stop()
+{
+    if [ -n "$1" ];then
+        stop="stop_$@"
+        state=`define $stop`
+        if [ $state = 1 ];then
+            echo $stop
+            status=`$stop`
+            echo $status
+            rm -rf /share/process/$1
+        fi
+    fi
+}
+monit()
+{
+    if [ -n "$1" ];then
+        monit="monit_$@"
+        state=`define $monit`
+        if [ $state = 1 ];then
+            status=`$monit`
+        fi
+    fi
+}
+load
+hosts
+start $@
+if [ "$2" == "exit" ]; then
+    exit 0
+fi
+trap "stop $1" HUP INT QUIT ABRT KILL ALRM TERM EXIT
+
+while true
+do
+    monit $@
+    sleep 5
+done
+#exec sh
+exit 0

+ 57 - 0
src/docker/build/os/ubuntu/process.sh

@@ -0,0 +1,57 @@
+#!/usr/bin/env sh
+set -e
+process_status()
+{
+    var=$*
+    pids=`ps aux|grep "$var"|grep -v entrypoint|grep -v grep|grep -v process|awk '{print $1}'`
+    if [ "$pids" ]; then
+        echo $pids
+    else
+        echo 1
+    fi
+}
+process_start()
+{
+    status=`process_status $*`
+    if [ "$status" == 1 ]; then
+        echo "$* starting"
+        $@ >/dev/null &
+        echo "$* started"
+    else
+        echo "$* started"
+    fi
+}
+process_stop()
+{
+    status=`process_status $*`
+    if [ "$status" == 1 ]; then
+        echo "$* stoped"
+    else
+        echo "stoping $*"
+        for pid in $status
+        do
+            kill -TERM ${pid} >/dev/null 2>&1
+        done
+        echo "$* stoped"
+    fi
+}
+process_restart()
+{
+    process_stop $*
+    sleep 5
+    p=`process_command`
+    echo `$p`
+}
+process_monit()
+{
+    status=`process_status $*`
+    if [ "$status" == 1 ]; then
+        p=`process_command`
+        echo `$p`
+    fi
+}
+process_command()
+{
+    p=$(cat /process)
+    echo $p
+}

+ 15 - 10
src/docker/build/os/ubuntu/sources.list

@@ -1,10 +1,15 @@
-deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
-deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
-deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
-deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
-deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
-deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
-deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
-deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
-deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
-deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
+# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
+deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
+# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
+deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
+# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
+deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
+# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
+
+# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
+deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
+# deb-src http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
+
+# 预发布软件源,不建议启用
+# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
+# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse

+ 3 - 0
src/docker/build/tool/douyin/Dockerfile

@@ -0,0 +1,3 @@
+FROM evil0ctal/douyin_tiktok_download_api:latest
+
+MAINTAINER Rabin "https://github.com/shemic"

+ 3 - 0
src/docker/build/tool/koishi/Dockerfile

@@ -0,0 +1,3 @@
+FROM koishijs/koishi
+
+MAINTAINER Rabin "https://github.com/shemic"

+ 7 - 1
src/docker/conf/tool.conf

@@ -72,4 +72,10 @@ port = 8080:80,5000:5000
 
 [lottery]
 image = project_lottery
-port = 8080:8888,9000:9000,9001:18888
+port = 8080:8888,9000:9000,9001:18888
+
+
+;douyin
+[douyin]
+image = douyin
+port = 8085:80

+ 8 - 0
src/docker/conf/web.conf

@@ -54,6 +54,14 @@ volumes = {container}web:/www,{container}conf/web/php7:/etc/php7
 port = 3366:3366
 volumes = {container}web:/www,{container}conf/web/php7:/etc/php7,{container}conf/web/smproxy:/usr/local/smproxy/conf,{container}logs/{name}/logs:/usr/local/smproxy/logs
 
+[php8]
+#port = 8082:8080
+#image = php7_swoole
+image = ubuntu
+#port = 2346:2346,1236:1236,1237:1237,1238:1238,8282:8282
+volumes = {container}web:/www,{container}conf/web/php83:/etc/php83
+alias = php,composer,pecl,apk,/install.sh->phpInstall
+
 [#nginx]
 #num = 3
 # num和cluster都可以设置有多少个nginx进程,不同的是,cluster仅对ds有效

+ 4 - 0
src/docker/core.conf

@@ -18,9 +18,11 @@ debian				= os/debian
 ;dev
 php5				= dev/php/v5
 php7				= dev/php/v7
+php8                = dev/php/v8
 php7_swoole			= dev/php/swoole
 php7_smproxy		= dev/php/smproxy
 php7_spider         = dev/php/php7_spider
+
 java				= dev/java
 java_base			= java/base
 maven				= java/maven
@@ -91,6 +93,8 @@ vsftpd				= tool/vsftpd
 ffmpeg				= tool/ffmpeg
 walle				= tool/walle
 kiftd				= tool/kiftd
+douyin              = tool/douyin
+koishi              = tool/koishi
 
 ;learn
 learn				= learning