From cd9af7c6ab03a1f17a34ffcc10983d18f99f3ad2 Mon Sep 17 00:00:00 2001 From: beeb Date: Fri, 28 May 2021 12:06:07 +0200 Subject: [PATCH] Added dockerfile --- .dockerignore | 13 +++++++++++++ Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7077370 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +* + +!pancaketrade/*.py +!pancaketrade/conversations/*.py +!pancaketrade/network/*.py +!pancaketrade/persistence/*.py +!pancaketrade/utils/*.py +!pancaketrade/watchers/*.py +!pancaketrade/abi +!poetry.lock +!poetry.toml +!pyproject.toml +!schema.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27984de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM python:3.9-buster AS build-deps + +WORKDIR /app + +ENV PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 \ + PIP_NO_CACHE_DIR=off \ + PIP_DISABLE_PIP_VERSION_CHECK=on \ + # poetry will be installed here + POETRY_HOME="/opt/poetry" \ + POETRY_NO_INTERACTION=1 \ + POETRY_NO_ANSI=1 +# add poetry to path +ENV PATH="$POETRY_HOME/bin:$PATH" + +# install poetry +RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - + +COPY . ./ +RUN poetry install --no-dev + +FROM python:3.9-slim-buster + +WORKDIR /app +# the user needs to be able to write the database file to /app +RUN chown 1000:1000 /app + +ENV PYTHONUNBUFFERED=1 \ + VENV_PATH="/app/.venv" +# add virtual environment binaries to path +ENV PATH="$VENV_PATH/bin:$PATH" + +COPY --from=build-deps /app . + +USER 1000 + +ENTRYPOINT [ "trade" ] +CMD [ "config.yml" ] diff --git a/README.md b/README.md index a997765..30b82fd 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ the mechanism of this bot. ## Features -The bot provides a lot of convenience trading featuers including: +The bot provides a lot of convenience trading features including: - Tokens balance and price shown in status messages - Ability to make buy and sell limit orders including trailing stop loss