diff --git a/Dockerfile b/Dockerfile index 6c5bdbb..65ffbe8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,24 +4,38 @@ ARG CLI_VERSION ARG SDK_VERSION ARG PIP_INDEX_URL=https://pypi.org/simple ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple +ARG USE_LOCAL_INSTALL=false RUN apk update \ && apk add --no-cache git nodejs npm yarn curl \ && npm install @coana-tech/cli -g # Install uv -RUN curl -LsSf https://astral.sh/uv/install.sh | sh -ENV PATH="/root/.cargo/bin:${PATH}" +COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv -# Install CLI with retries for TestPyPI propagation (10 attempts, 30s each = 5 minutes total) -RUN for i in $(seq 1 10); do \ - echo "Attempt $i/10: Installing socketsecurity==$CLI_VERSION"; \ - if pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketsecurity==$CLI_VERSION; then \ - break; \ +# Install CLI based on build mode +RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \ + echo "Using local development install"; \ + else \ + for i in $(seq 1 10); do \ + echo "Attempt $i/10: Installing socketsecurity==$CLI_VERSION"; \ + if pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketsecurity==$CLI_VERSION; then \ + break; \ + fi; \ + echo "Install failed, waiting 30s before retry..."; \ + sleep 30; \ + done && \ + if [ ! -z "$SDK_VERSION" ]; then \ + pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \ fi; \ - echo "Install failed, waiting 30s before retry..."; \ - sleep 30; \ - done && \ - if [ ! -z "$SDK_VERSION" ]; then \ - pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \ - fi \ No newline at end of file + fi + +# Copy local source and install in editable mode if USE_LOCAL_INSTALL is true +COPY . /app +WORKDIR /app +RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \ + pip install --upgrade -e .; \ + pip install --upgrade socketdev; \ + fi + +# ENTRYPOINT ["socketcli"] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cf3abcb..c1ab9cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "socketsecurity" -version = "2.2.23" +version = "2.2.26" requires-python = ">= 3.10" license = {"file" = "LICENSE"} dependencies = [ @@ -16,7 +16,7 @@ dependencies = [ 'GitPython', 'packaging', 'python-dotenv', - 'socketdev>=3.0.16,<4.0.0', + 'socketdev>=3.0.17,<4.0.0', "bs4>=0.0.2", ] readme = "README.md" diff --git a/scripts/build_container.sh b/scripts/build_container.sh index f268246..2e078d4 100755 --- a/scripts/build_container.sh +++ b/scripts/build_container.sh @@ -24,9 +24,15 @@ verify_package() { echo $VERSION if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then - echo "$0 pypi-build=enable stable=true" - echo "\tpypi-build: Build and publish a new version of the package to pypi. Options are prod or test" - echo "\tstable: Only build and publish a new version for the stable docker tag if it has been tested and going on the changelog" + echo "$0 pypi-build=