update action
All checks were successful
Build NGINX on Ubuntu / build-nginx (push) Successful in 1m34s
All checks were successful
Build NGINX on Ubuntu / build-nginx (push) Successful in 1m34s
This commit is contained in:
parent
9e13f6dba0
commit
2c9b9cd223
@ -95,15 +95,21 @@ jobs:
|
|||||||
|
|
||||||
echo "等待服务启动..."
|
echo "等待服务启动..."
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
echo "检查 NGINX 进程..."
|
echo "检查 NGINX 进程..."
|
||||||
ps aux | grep nginx
|
ps aux | grep nginx
|
||||||
echo "测试 HTTP 连接..."
|
|
||||||
|
echo "测试 HTTP 连接..."
|
||||||
curl -v localhost || echo "HTTP 测试失败,但继续执行"
|
curl -v localhost || echo "HTTP 测试失败,但继续执行"
|
||||||
|
|
||||||
echo "停止 NGINX..."
|
echo "停止 NGINX..."
|
||||||
sudo /usr/local/nginx/sbin/nginx -s quit
|
sudo /usr/local/nginx/sbin/nginx -s quit
|
||||||
|
|
||||||
|
- name: 准备 Docker 构建上下文
|
||||||
|
run: |
|
||||||
|
echo "复制 nginx 文件到构建上下文..."
|
||||||
|
sudo cp -r /usr/local/nginx ./nginx-install
|
||||||
|
sudo chown -R $(whoami):$(whoami) ./nginx-install
|
||||||
|
|
||||||
- name: 创建 Dockerfile
|
- name: 创建 Dockerfile
|
||||||
run: |
|
run: |
|
||||||
cat > Dockerfile << 'EOF'
|
cat > Dockerfile << 'EOF'
|
||||||
@ -118,12 +124,13 @@ jobs:
|
|||||||
libxslt1.1 \
|
libxslt1.1 \
|
||||||
libgd3 \
|
libgd3 \
|
||||||
libgeoip1 \
|
libgeoip1 \
|
||||||
libxml2 && \
|
libxml2 \
|
||||||
|
curl && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 复制编译好的 nginx
|
# 复制编译好的 nginx
|
||||||
COPY /usr/local/nginx /usr/local/nginx
|
COPY nginx-install /usr/local/nginx
|
||||||
|
|
||||||
# 创建 nginx 用户
|
# 创建 nginx 用户
|
||||||
RUN useradd --system --home /var/cache/nginx --shell /sbin/nologin --comment "nginx user" --user-group nginx
|
RUN useradd --system --home /var/cache/nginx --shell /sbin/nologin --comment "nginx user" --user-group nginx
|
||||||
@ -138,8 +145,7 @@ jobs:
|
|||||||
# 健康检查
|
# 健康检查
|
||||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
CMD curl -f http://localhost/ || exit 1
|
CMD curl -f http://localhost/ || exit 1
|
||||||
|
# 启动 nginx
|
||||||
# 启动 nginx
|
|
||||||
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
|
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -157,7 +163,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "标记镜像..."
|
echo "标记镜像..."
|
||||||
docker tag nginx-local:latest ${{ secrets.HARBOR_REGISTRY }}/test/nginx:${{ github.sha }}
|
docker tag nginx-local:latest ${{ secrets.HARBOR_REGISTRY }}/test/nginx:${{ github.sha }}
|
||||||
docker tag nginx-local:d'datest ${{ secrets.HARBOR_REGISTRY }}/test/nginx:latest
|
docker tag nginx-local:latest ${{ secrets.HARBOR_REGISTRY }}/test/nginx:latest
|
||||||
|
|
||||||
echo "推送镜像..."
|
echo "推送镜像..."
|
||||||
docker push ${{ secrets.HARBOR_REGISTRY }}/test/nginx:${{ github.sha }}
|
docker push ${{ secrets.HARBOR_REGISTRY }}/test/nginx:${{ github.sha }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user