Skip to content

Commit b9044b4

Browse files
committed
升级
1 parent 26fa603 commit b9044b4

File tree

6 files changed

+113
-8
lines changed

6 files changed

+113
-8
lines changed

Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
1414
RUN apk add --no-cache --virtual .build-deps \
1515
tzdata \
1616
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
17-
&& echo "${TZ}" > /etc/timezone \
18-
&& apk del .build-deps
17+
&& echo "${TZ}" > /etc/timezone
1918

2019
RUN apk add --no-cache --virtual .build-deps \
2120
$PHPIZE_DEPS \
22-
supervisor \
2321
libpng \
2422
curl \
2523
g++ \
@@ -68,7 +66,6 @@ RUN apk add --no-cache --virtual .build-deps \
6866
&& docker-php-source delete \
6967
&& pecl clear-cache
7068

71-
7269
# Copy php configuration files
7370
# COPY conf/php/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf
7471
COPY php/php.ini /usr/local/etc/php/php.ini
@@ -221,14 +218,21 @@ RUN apk add --no-cache --virtual .build-deps \
221218
&& ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
222219
&& ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log
223220

221+
RUN apk add --no-cache \
222+
supervisor \
223+
libstdc++ \
224+
cyrus-sasl
225+
224226
# Add additional binaries into PATH for convenience
225227
ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
226228

227229
# # Copy nginx configuration files
228230
# COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
229231
# COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
230232
COPY nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
231-
COPY nginx/conf.d /etc/nginx/conf.d
233+
COPY nginx/conf.d /etc/nginx/conf.d
234+
COPY ./src /usr/local/openresty/nginx/html
235+
RUN mkdir -p /home/www-data/wwwlogs
232236

233237
# CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]
234238

@@ -250,3 +254,4 @@ WORKDIR /usr/local/openresty/nginx/html
250254
EXPOSE 80 443 9000
251255

252256
CMD ["/usr/bin/supervisord", "-n","-c", "/etc/supervisord.conf"]
257+
# ENTRYPOINT ["/usr/bin/supervisord", "-n","-c", "/etc/supervisord.conf"]

bash.sh

-2
This file was deleted.

deploy.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
# 部署项目
3+
# 重新构建
4+
5+
set -e
6+
CURL_PATH=/app/docker-openresty-php-fpm
7+
cd /app/docker-openresty-php-fpm
8+
9+
export_image() {
10+
echo "[export] 开始 启动 "
11+
docker export shengle-o-p >shengle-o-p.tar
12+
echo "[export] 启动 完成"
13+
}
14+
15+
import_image() {
16+
echo "[import] 开始 启动 "
17+
docker import ./shengle-o-p.tar s-o-p
18+
echo "[import] 启动 完成"
19+
}
20+
21+
stop() {
22+
echo "[stop] 开始 启动 "
23+
docker stop shengle-o-p
24+
docker rm shengle-o-p
25+
echo "[stop] 启动 完成"
26+
}
27+
28+
start() {
29+
echo "[start] 开始 启动 "
30+
docker run -it -d -p 9080:80 -p 9443:443 \
31+
-v $CURL_PATH/php/php.ini:/usr/local/etc/php/php.ini \
32+
-v $CURL_PATH/php/php-fpm.d:/usr/local/etc/php-fpm.d \
33+
-v $CURL_PATH/nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf \
34+
-v $CURL_PATH/nginx/conf.d:/etc/nginx/conf.d \
35+
-v $CURL_PATH/supervisor/supervisord.conf:/etc/supervisord.conf \
36+
-v $CURL_PATH/supervisor/conf.d:/etc/supervisor/conf.d \
37+
-v /app:/app \
38+
-v /app/wwwlogs:/home/www-data/wwwlogs \
39+
--name shengle-o-p \
40+
s-o-p \
41+
/usr/bin/supervisord -n -c /etc/supervisord.conf
42+
echo "[start] 启动 完成"
43+
}
44+
45+
# 部署
46+
deploy() {
47+
# 导出镜像
48+
# export_image
49+
# 导入镜像
50+
import_image
51+
# 停止镜像
52+
stop
53+
# 启动
54+
start
55+
}
56+
57+
deploy

learn

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
导出镜像
2+
3+
docker export shengle-o-p > shengle-o-p.tar
4+
5+
导入镜像
6+
7+
docker import shengle-o-p.tar shengle-o-p
8+
9+
10+
启动镜像
11+
12+
docker run -it -d -p 80:80 -p 443:443 -v /app/sldc-image-deploy/php/php-fpm.d:/usr/local/etc/php-fpm.d -v /app/sldc-image-deploy/nginx/conf.d:/etc/nginx/conf.d -v /app/wwwlogs:/home/www-data/wwwlogs -v /data/wwwroot:/var/www/html --name shengle-o-p s-o-p /usr/bin/supervisord -n -c /etc/supervisord.conf
13+
14+
15+
# 测试构建
16+
# 构建
17+
docker stop sop-test && docker rm sop-test && docker build -t yongze/sop-test . && docker run -it --name sop-test yongze/sop-test sh
18+
19+
docker stop sop-test && docker rm sop-test && docker run -it --name sop-test yongze/sop-test sh
20+
21+
22+
23+
docker run -it --name sop-test yongze/sop-test sh
24+
25+
26+
docker build -t s-o-p .
27+
28+
29+
# 之前的
30+
s-o-p latest be85912a9dc5 2 hours ago 229 MB
31+
nginx version: openresty/1.19.3.2
32+
PHP 7.2.10 (cli) (built: Sep 15 2018 02:49:26) ( NTS )
33+
34+
# 之后的
35+
36+
37+
# 运行
38+
# 临时
39+
docker run -it yongze/sop-test sh

nginx/conf.d/api.shenglediancang.com.conf

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ server {
5050
access_log off;
5151
}
5252

53+
## lua
54+
location /_show_34 {
55+
default_type text/plain;
56+
content_by_lua 'ngx.say("hi api.._show_34....")';
57+
}
58+
5359
access_log /home/www-data/wwwlogs/api.shenglediancang.com.log sldc_access;
5460
error_log /home/www-data/wwwlogs/api.shenglediancang.com.error.log;
5561
}

nginx/conf.d/default.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server {
22
listen 80;
3-
server_name localhost;
3+
server_name localhost _;
44

55
#charset koi8-r;
66
#access_log /var/log/nginx/host.access.log main;

0 commit comments

Comments
 (0)