Skip to content

Commit

Permalink
Initial successful attempt at dockerfile. Will consider other options…
Browse files Browse the repository at this point in the history
… before sticking to this.
  • Loading branch information
DeepBlockDeepak committed May 13, 2024
1 parent cbeec0d commit 6bedfe6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion 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 @@ -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]
Expand Down Expand Up @@ -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"

0 comments on commit 6bedfe6

Please sign in to comment.