diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..0d0e7ae3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,69 @@ +# Git +.git +.gitignore +.gitattributes +.gitmodules + +# Documentation +doc/ +*.md +!README.md + +# IDE and editor files +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# Python cache +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# Virtual environments +venv/ +ENV/ +env/ + +# Test and coverage +.coverage +.tox/ +.nox/ +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# CI/CD +.travis.yml +.github/ + +# Linting configs +.cardboardlint.yml +.coveragerc +.pycodestylerc +.pydocstylerc +.pylintrc + +# Docker (avoid recursion) +Dockerfile +docker-compose.yml +.dockerignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..fc4287e2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,55 @@ +# ChemTools Docker Configuration +# Based on miniconda2 for Python 2.7 + conda support +# Addresses GitHub Issue #42: Docker Update + +FROM continuumio/miniconda2:latest + +LABEL maintainer="ChemTools Dev Team " +LABEL description="ChemTools - Interpretive Chemical Tools for Quantum Chemistry" +LABEL version="2.0" + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + git \ + git-lfs \ + && rm -rf /var/lib/apt/lists/* \ + && git lfs install + +# Configure conda channels +RUN conda config --set always_yes yes && \ + conda config --add channels theochem && \ + conda config --add channels conda-forge + +# Create conda environment and install dependencies +RUN conda create -n chemtools python=2.7 && \ + /bin/bash -c "source activate chemtools && \ + conda install -c theochem horton=2.1.0 && \ + conda clean -afy" + +# Set up the conda environment to activate by default +ENV PATH="/opt/conda/envs/chemtools/bin:$PATH" +ENV CONDA_DEFAULT_ENV=chemtools + +# Set working directory +WORKDIR /chemtools + +# Copy project files +COPY . . + +# Install ChemTools +RUN /bin/bash -c "source activate chemtools && pip install -e ." + +# Create a non-root user for security +RUN useradd -m -s /bin/bash chemtools_user && \ + chown -R chemtools_user:chemtools_user /chemtools + +USER chemtools_user + +# Default command +ENTRYPOINT ["/bin/bash", "-c", "source activate chemtools && exec \"$@\"", "--"] +CMD ["chemtools", "--help"] diff --git a/README.md b/README.md index 71aa6512..1e6abc50 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,43 @@ To run tests: nosetests -v chemtools ``` +Docker +------ + +ChemTools can be run using Docker, which simplifies dependency management. + +### Building the Image + +```bash +docker build -t chemtools:latest . +``` + +### Running ChemTools + +```bash +# Show help +docker run --rm chemtools:latest chemtools --help + +# Run with mounted data directory +docker run --rm -v $(pwd)/data:/chemtools/data chemtools:latest chemtools + +# Interactive shell +docker run --rm -it chemtools:latest /bin/bash +``` + +### Using Docker Compose + +```bash +# Build and run +docker-compose up --build + +# Run tests +docker-compose run chemtools-test + +# Run a specific command +docker-compose run chemtools chemtools --help +``` + Development ----------- New contributors of all programming levels are welcome to join us. You can follow diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..e929c1a2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +# ChemTools Docker Compose Configuration +# Usage: docker-compose up --build +# Or run commands: docker-compose run chemtools + +version: '3.8' + +services: + chemtools: + build: + context: . + dockerfile: Dockerfile + image: chemtools:latest + container_name: chemtools + volumes: + # Mount local data directory for input/output files + - ./data:/chemtools/data + # Mount examples for easy access + - ./examples:/chemtools/examples:ro + working_dir: /chemtools/data + # Override entrypoint for interactive shell access + stdin_open: true + tty: true + + # Service for running tests + chemtools-test: + build: + context: . + dockerfile: Dockerfile + image: chemtools:latest + container_name: chemtools-test + command: [ "nosetests", "-v", "chemtools" ] + volumes: + - ./chemtools:/chemtools/chemtools:ro