From f464425cbd39d598b5e9c59f6be91e17346ba250 Mon Sep 17 00:00:00 2001 From: Artur Lissin Date: Sat, 27 Sep 2025 19:06:03 +0000 Subject: [PATCH] build: improve pre commit messages --- .husky/prepare-commit-msg | 4 +++- Dockerfile | 21 ++++++++++++++------- bin/deploy/entry_dev.sh | 2 +- bin/deploy/entry_web.sh | 2 +- bin/deploy/health.sh | 2 +- bin/deploy/req.server.sh | 6 +++--- configs/docker/dev.Dockerfile | 2 +- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg index 7e4f738..79ce7fe 100644 --- a/.husky/prepare-commit-msg +++ b/.husky/prepare-commit-msg @@ -1,3 +1,5 @@ #!/bin/sh +CUR_DIR="$(dirname "$(realpath "$0")")" eval make dev -exec /dev/null || true +RUN groupdel ${USERNAME} 2>/dev/null || true +RUN groupadd --gid ${USER_GID} ${USERNAME} +RUN useradd --uid ${USER_UID} --gid ${USER_GID} -m -d ${HOME_MAIN} ${USERNAME} +RUN mkdir -p ${HOME_MAIN} \ && chown ${USERNAME}:${USERNAME} -R ${HOME_MAIN} ARG DOCKER_ENV_DIR @@ -27,13 +33,14 @@ ARG BUN_VER ARG BIN_DEPLOY_REQ_SERVER COPY ./${BIN_DEPLOY_REQ_SERVER} /install.sh - -RUN sh /install.sh && rm /install.sh +RUN bash /install.sh && rm /install.sh COPY --from=appbuilder /entry.sh /entry.sh COPY --from=appbuilder /health.sh /health.sh COPY --from=appbuilder $DOCKER_ENV_DIR/* $DOCKER_ENV_DIR/ +RUN rm -rf /tmp/app + WORKDIR /var/www/ RUN rm -rf /var/www/* @@ -42,10 +49,10 @@ COPY --from=appbuilder /var/www/ ./ RUN chown ${USERNAME}:${USERNAME} -R /var/www/ -HEALTHCHECK --interval=30s --timeout=3s --retries=2 CMD /bin/sh /health.sh +HEALTHCHECK --interval=30s --timeout=3s --retries=2 CMD /bin/bash /health.sh USER ${USERNAME} WORKDIR ${HOME_MAIN} -ENTRYPOINT ["/bin/sh", "/entry.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/bash", "/entry.sh"] \ No newline at end of file diff --git a/bin/deploy/entry_dev.sh b/bin/deploy/entry_dev.sh index bd49b0d..27c57d5 100644 --- a/bin/deploy/entry_dev.sh +++ b/bin/deploy/entry_dev.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash echo "add entrypoint script" sleep infinity diff --git a/bin/deploy/entry_web.sh b/bin/deploy/entry_web.sh index 19d8a70..5f03f56 100644 --- a/bin/deploy/entry_web.sh +++ b/bin/deploy/entry_web.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash echo "starting server - in /var/www/$APP_PRES_ROOT" cd "/var/www/$APP_PRES_ROOT" || exit 1 diff --git a/bin/deploy/health.sh b/bin/deploy/health.sh index 413c2a1..af005ed 100644 --- a/bin/deploy/health.sh +++ b/bin/deploy/health.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/bin/bash pgrep -f bun diff --git a/bin/deploy/req.server.sh b/bin/deploy/req.server.sh index c1d962a..b565227 100644 --- a/bin/deploy/req.server.sh +++ b/bin/deploy/req.server.sh @@ -5,11 +5,11 @@ apk add --no-cache procps-ng curl bash echo "installing bun -> /opt/bun" apk add --no-cache unzip if [ ! -d "/opt/bun" ]; then - echo "installing bun" + echo "Installing Bun in /opt/bun..." curl -fsSl https://bun.sh/install | bash -s "bun-$BUN_VER" mv "$HOME/.bun" /opt/bun - chmod 755 -R /opt/bun - ln -s "/opt/bun/bin/bun" "/usr/bin/bun" + chmod -R 755 /opt/bun + ln -s /opt/bun/bin/bun /usr/bin/bun fi echo "installing pm2" apk add --no-cache build-base make diff --git a/configs/docker/dev.Dockerfile b/configs/docker/dev.Dockerfile index 5325089..09b60b4 100644 --- a/configs/docker/dev.Dockerfile +++ b/configs/docker/dev.Dockerfile @@ -1,7 +1,7 @@ FROM docker.io/rockylinux:9 ARG BUN_BIN -ARG USERNAME=vscode +ARG USERNAME=devu ARG USER_UID=1000 ARG USER_GID=${USER_UID} ARG WORK_DIR=/workspace