tested dockerfile

This commit is contained in:
Mark 2023-12-14 21:46:12 +02:00
parent 412960d6c5
commit ea3d3554f2
4 changed files with 33 additions and 16 deletions

2
.idea/marketTrade.iml generated
View File

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Poetry (marketTrade) (2)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Poetry (marketTrade)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

5
.idea/misc.xml generated
View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (marketTrade) (2)" project-jdk-type="Python SDK" />
<component name="Black">
<option name="sdkName" value="Poetry (marketTrade)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (marketTrade)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>

View File

@ -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

28
dockerfiles/Dockerfile Normal file
View File

@ -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"]