diff --git a/.idea/marketTrade.iml b/.idea/marketTrade.iml index 0a14ceb..24b4394 100644 --- a/.idea/marketTrade.iml +++ b/.idea/marketTrade.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 829a1af..1519a2b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,9 @@ - + + + diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e3e614d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# syntax=docker/dockerfile:1 -FROM python:3.10-alpine - -# installing necessary software -- openssh for support of private repositories, connected through ssh, -# git for git based VCS for such software, gcc g++ and musl-dev for building necessary dependencies, which are not -# available as binaries -RUN apk add --update-cache openssh-client git gcc g++ musl-dev libpq - -# getting github ssh keys, to be ready to download private repos from there -RUN mkdir --parents --mode 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts - -# copying and installing requirements -COPY requirements.txt . -RUN --mount=type=ssh pip install -r requirements.txt \ No newline at end of file diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile new file mode 100644 index 0000000..c804122 --- /dev/null +++ b/dockerfiles/Dockerfile @@ -0,0 +1,28 @@ +FROM python:3.11-buster as builder + +RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.7.1 python3 - + + +ENV POETRY_NO_INTERACTION=1 \ + POETRY_VIRTUALENVS_IN_PROJECT=1 \ + POETRY_VIRTUALENVS_CREATE=1 \ + POETRY_CACHE_DIR=/tmp/poetry_cache + +WORKDIR /app + +COPY pyproject.toml poetry.lock ./ +RUN touch README.md + +RUN mkdir --parents --mode 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts +RUN --mount=type=ssh --mount=type=cache,target=$POETRY_CACHE_DIR $HOME/.local/bin/poetry install --without dev --no-root + +FROM python:3.11-slim-buster as runtime + +ENV VIRTUAL_ENV=/app/.venv \ + PATH="/app/.venv/bin:$PATH" + +COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} + +COPY market_trade ./market_trade + +ENTRYPOINT ["python", "-m", "annapurna.main"]