diff --git a/Dockerfile b/Dockerfile index 4803542..80a816e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,32 @@ -FROM python:3.11.1 -WORKDIR /app +FROM python:3.10 as base +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN apt-get update && \ - apt-get install -y cron \ - --no-install-recommends && \ - rm -rf /var/lib/apt/lists/* && \ - pip install poetry==1.3.2 --no-cache-dir +RUN apt-get update -y && apt-get install gcc -y && rm -rf /var/lib/apt/lists/* +RUN python3 -m venv $VIRTUAL_ENV +RUN pip install -U poetry pip setuptools -ENV POETRY_VIRTUALENVS_IN_PROJECT=true -COPY pyproject.toml ./ -RUN poetry install --only main -ENV PATH="/APP/.venv/bin:$PATH" +WORKDIR /workdir +COPY pyproject.toml /workdir +COPY poetry.lock /workdir +RUN chown -R $(whoami):$(whoami) /workdir +RUN poetry install --no-interaction +RUN poetry run apt-get update && apt-get install make git -y + +# Customize base image with agent deps +FROM python:3.10-slim-bullseye +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +COPY --from=base $VIRTUAL_ENV $VIRTUAL_ENV +RUN apt-get update -y && apt-get install gcc make -y && rm -rf /var/lib/apt/lists/* +ENV VIRTUAL_ENV=/opt/venv +# now we copy deps to be removed in later stages removed later +WORKDIR /workdir +COPY . . +ENV PYTHONPATH=. +ENTRYPOINT ["/opt/venv/bin/poetry"] +CMD ["run", "pytest", "tests"] diff --git a/README.md b/README.md index 96ddb5a..59ee317 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,12 @@ This is a Python client for the 100x API. It is a simple wrapper around the API, ## Installation ```bash pip install hundred-x +`` + +## Running a dockerised environment +```bash +docker buildx build --platform linux/amd64 . -t test +# now we have the dependencies installed, +# we can mount the current directory and run the tests against the dockerised environment +docker run -v (pwd):/app -it test ``` \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index c7007ca..5ab2061 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1534,6 +1534,7 @@ colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, {version = ">=0.3.6", markers = "python_version >= \"3.11\""}, + {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, ] isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" mccabe = ">=0.6,<0.8" @@ -1793,6 +1794,17 @@ files = [ {file = "rpds_py-0.18.0.tar.gz", hash = "sha256:42821446ee7a76f5d9f71f9e33a4fb2ffd724bb3e7f93386150b61a43115788d"}, ] +[[package]] +name = "safe-pysha3" +version = "1.0.4" +description = "SHA-3 (Keccak) for Python 3.9 - 3.11" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "safe-pysha3-1.0.4.tar.gz", hash = "sha256:e429146b1edd198b2ca934a2046a65656c5d31b0ec894bbd6055127f4deaff17"}, +] + [[package]] name = "schema" version = "0.7.5" @@ -2138,5 +2150,5 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" -python-versions = ">=3.9,<=3.11" -content-hash = "a4485cbec0888c5f1078655ccedbd51d852024e252c37c5a4fcfcc88d5d75186" +python-versions = ">=3.9,<=3.12" +content-hash = "c6097a7800c21655984c1b1bd2e323e17faa90c8a361514e338fd56438dcfcb4" diff --git a/pyproject.toml b/pyproject.toml index e1370c9..6bfcb49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,12 +7,13 @@ readme = "README.md" packages = [{include = "hundred_x"}] [tool.poetry.dependencies] -python = ">=3.9,<=3.11" +python = ">=3.9,<=3.12" requests = "^2.31.0" eth-account = "<=0.11.0" eip712-structs = "^1.1.0" web3 = ">=5,<6" websockets = ">=9" +safe-pysha3 = "^1.0.4" [tool.poetry.group.dev.dependencies]