From e279b75c49a039ed897ae47d6e85fc01821f2ec6 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 21 May 2025 14:23:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=85=8D=E7=BD=AE=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-docker.sh | 4 ++-- pkg/docker/Dockerfile.ubuntu22.04 | 8 ++------ .../linux/usr/local/etc/omc/script/entrypoint.sh | 13 +++++++------ .../linux/usr/local/etc/omc/script/postunpack.sh | 4 ++-- pkg/docker/tar/omc-docker.sh | 3 +-- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/build-docker.sh b/build-docker.sh index 6db7fb7..f22e7c5 100644 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -xe + # Check if Docker is installed if command -v docker &> /dev/null; then echo $(docker --version) @@ -134,7 +134,6 @@ docker_build() { # tar package output=${ReleaseDir}/${ReleaseFileName}.tar.gz tar -czf ${output} ./${ReleaseFileName} - echo "tar output ${output}" # Generate MD5 file rm -f omc_md5sum.txt @@ -156,3 +155,4 @@ docker_build # bash build-docker.sh --version 2.2505.2 --platform amd64 --system ubuntu22.04 +# bash build-docker.sh --version 2.2505.2 --platform amd64 --system alpine3.20 diff --git a/pkg/docker/Dockerfile.ubuntu22.04 b/pkg/docker/Dockerfile.ubuntu22.04 index 8741ef3..f79f422 100644 --- a/pkg/docker/Dockerfile.ubuntu22.04 +++ b/pkg/docker/Dockerfile.ubuntu22.04 @@ -76,13 +76,11 @@ EXPOSE 80 443 33030 33443 33033 33034 33060 CMD [ "/usr/local/etc/omc/script/entrypoint.sh" ] -# build 546 MB +# build 707MB # docker docker build --platform linux/amd64 --build-arg TARGETARCH=amd64 --build-arg VERSION=2.2505.2 -t omc:r2.2505.2-ubuntu22.04-amd64 . -# service ssh start && service nginx start && /usr/local/bin/omc --env prod -c /usr/local/etc/omc/omc.yaml -# docker run -it omc:2.2505.2-ubuntu22.04-amd64 /bin/bash +# docker run --network omcnet -it omc:2.2505.2-ubuntu22.04-amd64 /bin/bash -# docker run --privileged=true --restart=always -m 512M -e M_PARAM=lite --name omc_2.2505.2 -d omc:2.2505.2-ubuntu22.04-amd64 # docker run --privileged=true --restart=always -m 512M \ # -e TZ=Asia/Shanghai \ # -e M_PARAM=lite \ @@ -91,5 +89,3 @@ CMD [ "/usr/local/etc/omc/script/entrypoint.sh" ] # --network omcnet \ # --name omc \ # -d omc:2.2505.2-ubuntu22.04-amd64 -# docker rm -f omc_2.2505.2 -# docker run -it omc_2.2505.2 bash diff --git a/pkg/docker/linux/usr/local/etc/omc/script/entrypoint.sh b/pkg/docker/linux/usr/local/etc/omc/script/entrypoint.sh index 6f7d046..0c5f737 100644 --- a/pkg/docker/linux/usr/local/etc/omc/script/entrypoint.sh +++ b/pkg/docker/linux/usr/local/etc/omc/script/entrypoint.sh @@ -1,5 +1,4 @@ #!/bin/bash - # shellcheck disable=SC1091 set -o errexit @@ -12,15 +11,17 @@ set -o pipefail # We add the copy from default config in the entrypoint to not break users # case someone mounts a configuration file in /usr/local/etc/omc/default) -cp -nr "$BASE_DIR"/default/. "$BASE_DIR" +cp -n $BASE_DIR/default/omc.conf $BASE_DIR/omc.conf +cp -n $BASE_DIR/default/omc.yaml $BASE_DIR/omc.yaml +# cp -n $BASE_DIR/default/sshsvc.yaml $BASE_DIR/sshsvc.yaml # Initialize OMC DB if [ ! -f /usr/local/etc/omc/machine.ini ]; then bash /usr/local/etc/omc/script/setup.sh -i -r -m $M_PARAM -c $C_PARAM fi -# Start Nginx server -nginx -g "daemon off;" +# Start Nginx server | -s stop +nginx # Parse CLI flags to pass to the 'omc' call args=("--config" "${BASE_DIR}/omc.yaml") @@ -30,5 +31,5 @@ read -r -a extra_flags <<< "$CMD_EXTRA_FLAGS" # Add flags passed to this script args+=("$@") -omc --version -exec omc "${args[@]}" +# Run omc +omc "${args[@]}" diff --git a/pkg/docker/linux/usr/local/etc/omc/script/postunpack.sh b/pkg/docker/linux/usr/local/etc/omc/script/postunpack.sh index d67aa5d..ae2a654 100644 --- a/pkg/docker/linux/usr/local/etc/omc/script/postunpack.sh +++ b/pkg/docker/linux/usr/local/etc/omc/script/postunpack.sh @@ -23,9 +23,9 @@ cp $BASE_DIR/default/omc.yaml $BASE_DIR/omc.yaml sed -i "s/port: 33030/port: $API_HTTP_PORT/" "$BASE_DIR"/omc.yaml sed -i "s/port: 33443/port: $API_HTTPS_PORT/" "$BASE_DIR"/omc.yaml sed -i '/webServer:/,/-/s/^\( *enabled:\) true/\1 false/' "$BASE_DIR"/omc.yaml -sed -i '/type: "mysql"/,/-/s/^\( *host:\) "127.0.0.1"/\1 "omc_mariadb"/' "$BASE_DIR"/omc.yaml +sed -i 's/host: "127.0.0.1"$/host: "omc_mariadb"/' "$BASE_DIR"/omc.yaml sed -i 's/port: 33066/port: 3306/' "$BASE_DIR"/omc.yaml -sed -i '/port: 6379 # Redis port/ {n; s/host: "127.0.0.1"/host: "omc_keydb"/}' "$BASE_DIR"/omc.yaml +sed -i 's/host: "127.0.0.1" # Redis host$/host: "omc_keydb" # Redis host/' "$BASE_DIR"/omc.yaml # Nginx config sed -i 's/# gzip_/gzip_/' /etc/nginx/nginx.conf diff --git a/pkg/docker/tar/omc-docker.sh b/pkg/docker/tar/omc-docker.sh index c7b2b59..5c063bd 100644 --- a/pkg/docker/tar/omc-docker.sh +++ b/pkg/docker/tar/omc-docker.sh @@ -31,9 +31,8 @@ install(){ echo "Container name ($OMC_CONTAINER_NAME):" read OMC_CONTAINER_NAME OMC_CONTAINER_NAME=${OMC_CONTAINER_NAME:-"omc"} - echo "==> Checking Docker version $OMC_CONTAINER_NAME" sed -i "s/^OMC_CONTAINER_NAME=.*/OMC_CONTAINER_NAME=\"$OMC_CONTAINER_NAME\"/" ./omc-docker.sh - echo "===================== Install container omc service =====================" + echo "===================== Start =====================" echo "==> Checking Docker version" if sudo docker -v > /dev/null 2>&1; then