From 6bedfe6a321e2594741b22824e3f130ac7e819bc Mon Sep 17 00:00:00 2001 From: DeepBlockDeepak Date: Mon, 13 May 2024 00:09:44 -0600 Subject: [PATCH] Initial successful attempt at dockerfile. Will consider other options before sticking to this. --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ poetry.lock | 2 +- pyproject.toml | 3 ++- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5c0158f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# Base Image +FROM python:3.11-slim + +# Argument for environment (default to development) +ARG YOUR_ENV=development +ARG POETRY_VERSION=1.7.1 + +# Environment Variables for Python and Poetry +ENV YOUR_ENV=${YOUR_ENV} \ + PYTHONFAULTHANDLER=1 \ + PYTHONUNBUFFERED=1 \ + PYTHONHASHSEED=random \ + PIP_NO_CACHE_DIR=off \ + PIP_DISABLE_PIP_VERSION_CHECK=on \ + PIP_DEFAULT_TIMEOUT=100 \ + POETRY_NO_INTERACTION=1 \ + POETRY_VIRTUALENVS_CREATE=false \ + POETRY_CACHE_DIR="/var/cache/pypoetry" \ + POETRY_HOME="/usr/local/poetry" \ + PATH="${POETRY_HOME}/bin:$PATH" \ + PYTHONPATH="/code/src" + +# Install curl and Poetry +RUN apt-get update && apt-get install -y curl && \ + curl -sSL https://install.python-poetry.org | python3 - && \ + ln -s ${POETRY_HOME}/bin/poetry /usr/local/bin/poetry && \ + poetry --version # Verify Poetry installation + +# Set working directory +WORKDIR /code + +# Copy dependency files +COPY pyproject.toml poetry.lock /code/ + +# Install dependencies based on the environment +RUN /usr/local/bin/poetry install $(test "$YOUR_ENV" = production && echo "--only=main") --no-interaction --no-ansi + +# Copy the rest of the project files +COPY . /code + +# Ensures all entry points and scripts in pyproject.toml are correctly installed and registered +RUN poetry install --no-interaction --no-ansi --with dev \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index dda968d..ec49562 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1900,4 +1900,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.12" -content-hash = "948e2d049c842febcb67dfedf7e1224d66fd24edba49a84e178c28cdc0221a6c" +content-hash = "fddbc3ca708a535ed46ac4c0ec04b42b0e0bcfda08ac1e763d5fb182bc3fa22f" diff --git a/pyproject.toml b/pyproject.toml index b491953..1cf87dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ kaggle = "^1.5.16" pyarrow = "^15.0.0" torch = "^2" pydantic = "^2.7.1" +numpy = "^1.24.0" # Development dependencies for formatting and linting [tool.poetry.dev-dependencies] @@ -57,5 +58,5 @@ coverage = "scripts.coverage_test:run" all-checks = "scripts.all_checks:run_all" [build-system] -requires = ["poetry-core"] +requires = ["poetry-core>=1.6"] build-backend = "poetry.core.masonry.api" \ No newline at end of file