[fix:1.16]更新Dockerfile中PCRE下载地址;更新Makefile;更新配置文件,删除默认用户
This commit is contained in:
+3
-2
@@ -183,8 +183,9 @@ RUN \
|
||||
# 下载需要的软件包资源。可使用 不校验、签名校验、SHA256 校验 三种方式
|
||||
DIST_NAME="pcre-${PCRE_VERSION}.tar.gz"; \
|
||||
DIST_URLS=" \
|
||||
${local_url}pcre/ \
|
||||
https://nchc.dl.sourceforge.net/project/pcre/pcre/${PCRE_VERSION}/ \
|
||||
${local_url}/pcre/ \
|
||||
https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION}/ \
|
||||
https://jaist.dl.sourceforge.net/project/pcre/pcre/${PCRE_VERSION}/ \
|
||||
"; \
|
||||
. /usr/local/scripts/libdownload.sh && download_dist "${DIST_NAME}" "${DIST_URLS}"; \
|
||||
\
|
||||
|
||||
@@ -1,17 +1,34 @@
|
||||
# Ver: 1.0 by Endial Fang (endial@126.com)
|
||||
# Ver: 1.2 by Endial Fang (endial@126.com)
|
||||
#
|
||||
# 当前 Docker 镜像的编译脚本
|
||||
|
||||
app_name := colovu/nginx
|
||||
current_branch := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
# 生成镜像TAG,类似:<镜像名>:<分支名>-<Git ID> 或 <镜像名>:latest-<年月日>-<时分秒>
|
||||
current_subversion:=$(shell if [[ -d .git ]]; then git rev-parse --short HEAD; else date +%y%m%d-%H%M%S; fi)
|
||||
current_tag:=$(shell if [[ -d .git ]]; then git rev-parse --abbrev-ref HEAD | sed -e 's/master/latest/'; else echo "latest"; fi)-$(current_subversion)
|
||||
|
||||
# Sources List: default / tencent / ustc / aliyun / huawei
|
||||
build-arg := --build-arg apt_source=tencent
|
||||
build-arg:=--build-arg apt_source=tencent
|
||||
|
||||
# 设置本地下载服务器路径,加速调试时的本地编译速度
|
||||
local_ip=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $$2}'|tr -d "addr:"`
|
||||
build-arg += --build-arg local_url=http://$(local_ip)/dist-files/
|
||||
local_ip:=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $$2}'|tr -d "addr:"`
|
||||
build-arg+=--build-arg local_url=http://$(local_ip)/dist-files/
|
||||
|
||||
.PHONY: build clean clearclean
|
||||
|
||||
build:
|
||||
docker rmi $(app_name):$(current_branch) || true
|
||||
docker build --force-rm $(build-arg) -t $(app_name):$(if $(current_branch),$(current_branch),latest) .
|
||||
@echo "Build $(app_name):$(current_tag)"
|
||||
@docker build --force-rm $(build-arg) -t $(app_name):$(current_tag) .
|
||||
@echo "Add tag: $(app_name):latest"
|
||||
@docker tag $(app_name):$(current_tag) $(app_name):latest
|
||||
|
||||
# 清理悬空的镜像(无TAG)及停止的容器
|
||||
clean:
|
||||
@echo "Clean untaged images and stoped containers..."
|
||||
@docker ps -a | grep "Exited" | awk '{print $$1}' | xargs docker rm
|
||||
@docker images | grep '<none>' | awk '{print $$3}' | xargs docker rmi -f
|
||||
|
||||
clearclean: clean
|
||||
@echo "Clean all images for current application..."
|
||||
@docker images | grep "$(app_name)" | awk '{print $$3}' | xargs docker rmi -f
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
# /etc/nginx/nginx.conf
|
||||
|
||||
# 针对 Docker 镜像使用,不能修改为其他用户
|
||||
user nginx;
|
||||
# 针对当前已使用 nginx 用户的 Docker 镜像使用时,不需要定义用户
|
||||
#user nginx;
|
||||
|
||||
# 关闭守护进程模式。如果设置为后台守护进程模式,容器在启动应用后会退出
|
||||
daemon off;
|
||||
|
||||
Reference in New Issue
Block a user