build: 移除Dockerfile中不必要的文件拷贝并添加构建脚本
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 24s

移除Dockerfile中不必要的/etc目录拷贝,避免镜像体积增大
添加build_docker.sh脚本用于自动化构建和推送镜像
This commit is contained in:
shanshanzhong 2025-10-14 08:25:07 -07:00
parent dca32cd11c
commit 7da63ade5c
2 changed files with 21 additions and 1 deletions

View File

@ -36,7 +36,6 @@ ENV TZ=Asia/Shanghai
WORKDIR /app WORKDIR /app
COPY --from=builder /app/ppanel /app/ppanel COPY --from=builder /app/ppanel /app/ppanel
COPY --from=builder /build/etc /app/etc
# Expose the port (optional) # Expose the port (optional)
EXPOSE 8080 EXPOSE 8080

21
script/build_docker.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# build-and-push.sh
set -e
cd /Users/Apple/vpn/ppanel-server
# 固定版本号为latest
VERSION=dev
# 构建镜像
echo "Building image with version: $VERSION"
docker build -f Dockerfile --platform linux/amd64 --build-arg TARGETARCH=amd64 -t registry.kxsw.us/ppanel/ario-server:$VERSION .
docker tag registry.kxsw.us/ppanel/ario-server:$VERSION registry.kxsw.us/ppanel/ario-server:latest
# 推送镜像
echo "Pushing image to registry.kxsw.us"
docker push registry.kxsw.us/ppanel/ario-server:$VERSION
docker push registry.kxsw.us/ppanel/ario-server:latest
echo "Build and push completed successfully!"
# docker-compose exec certbot certbot certonly --webroot --webroot-path=/etc/letsencrypt -d api-dev.kxsw.us