diff --git a/README.md b/README.md index 65269b0..bf85b6c 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ agi-pack --install-completion └── `docker build -f Dockerfile --target base-sklearn .` ``` -That's it! Use the generated `Dockerfile` to run `docker build` and build the image directly. +That's it! Here's the generated [`Dockerfile`](examples/generated/Dockerfile-quickstart) -- use it to run `docker build` and build the image directly. ## Goals 🎯 diff --git a/examples/generated/Dockerfile-quickstart b/examples/generated/Dockerfile-quickstart new file mode 100644 index 0000000..48a0693 --- /dev/null +++ b/examples/generated/Dockerfile-quickstart @@ -0,0 +1,63 @@ +# >>>>>>>>>>>>>>>>>>>>>>>>>>> +# Auto-generated by agi-pack. +FROM debian:buster-slim AS base-cpu + +# Setup environment variables +ENV PROJECT agi +ENV PYENV agi-py38 +ENV PYTHON_VERSION 3.8 +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 +ENV PYTHONWARNINGS ignore + +# Setup conda paths +ENV CONDA_PATH=/opt/conda/envs/${PYENV} +ENV CONDA_PREFIX=${CONDA_PATH} +ENV CONDA_EXE=${CONDA_PATH}/bin/conda +ENV PATH=${CONDA_PATH}/bin:/opt/conda/bin:$PATH +ENV CONDA_DEFAULT_ENV ${PYENV} + +# Setup environment variables +ENV MY_ENV_VAR=value + +# Install system packages +RUN apt-get -y update \ + && apt-get -y install \ + curl git \ + wget \ + && apt-get -y autoclean \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* + +# Install mambaforge +RUN curl -sLo ~/mambaforge.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh" \ + && chmod +x ~/mambaforge.sh \ + && ~/mambaforge.sh -b -p /opt/conda \ + && /opt/conda/bin/mamba init bash \ + && /opt/conda/bin/mamba config --set pip_interop_enabled True \ + && /opt/conda/bin/mamba create -n ${PYENV} python=${PYTHON_VERSION} -y \ + && rm ~/mambaforge.sh + +# Install pip packages, with cache mounting /opt/conda/pkgs for faster builds +# Note: Cache mounts allow us to re-use the cache for conda packages +# instead of having to re-download them every time we build. +RUN --mount=type=cache,target=/opt/conda/pkgs/ \ + mamba install -yv \ + loguru \ + scikit-learn \ + && echo "pip install complete" + +# Export conda environment on login +RUN echo "export CONDA_PATH=/opt/conda/envs/${PYENV}" >> ~/.bashrc +RUN echo "export PATH=/opt/conda/envs/${PYENV}/bin:$PATH" >> ~/.bashrc +RUN echo "export CONDA_DEFAULT_ENV=${PYENV}" >> ~/.bashrc +RUN echo "mamba activate ${PYENV}" > ~/.bashrc +ENTRYPOINT ["/bin/bash", "-c"] + +# Setup working directory +WORKDIR /app/$PYENV + +# Run commands +RUN \ + ls -la \ + && echo "run commands complete"