-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile-quickstart
57 lines (50 loc) · 1.81 KB
/
Dockerfile-quickstart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# >>>>>>>>>>>>>>>>>>>>>>>>>>>
# Auto-generated by agi-pack.
FROM debian:buster-slim AS sklearn-base
# Setup environment variables
ENV PROJECT agi
ENV PYENV agi-py38
ENV PYTHON_VERSION 3.8.10
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}
# Install system packages
RUN apt-get -y update \
&& apt-get -y install \
curl git \
wget \
build-essential \
&& 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 \
typer \
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