Skip to content

Commit

Permalink
Merge pull request #5 from 8ball030/feat/docker
Browse files Browse the repository at this point in the history
Feat/docker
  • Loading branch information
kjr217 authored May 8, 2024
2 parents 619860f + 3348ecb commit 90b342b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 14 deletions.
38 changes: 27 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]


8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
16 changes: 14 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 90b342b

Please sign in to comment.