in This Tutorial you will Learn " How To Dockerize Python Applications With Miniconda On Ubuntu 20.04"
Python is an interpreted high-level general-purpose programming language.
Miniconda is a free minimal installer for conda.
Docker is a software platform that allows you to build, test, and deploy applications quickly.
_________________________________________________________________________________________
docker-compose --version ; docker --version
mkdir project ; cd project ; nano Dockerfile
FROM python:slim
RUN apt-get update && apt-get -y upgrade \
&& apt-get install -y --no-install-recommends \
git \
wget \
g++ \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh \
&& echo "Running $(conda --version)" && \
conda init bash && \
. /root/.bashrc && \
conda update conda && \
conda create -n python-app && \
conda activate python-app && \
conda install python=3.6 pip && \
echo 'print("Hello World!")' > python-app.py
RUN echo 'conda activate python-app \n\
alias python-app="python python-app.py"' >> /root/.bashrc
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
CMD ["python python-app.py"]
docker build -t python-app .
docker images
docker run python-app
docker run -it python-app /bin/bash
python-app
python --version
_________________________________________________________________________________________
Friday, February 25, 2022
How To Dockerize Python Applications With Miniconda On Ubuntu 20.04
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment