this is my docker file:
WORKDIR /scan
RUN pip install pymongo
RUN pip install netmiko
RUN pip install pyats[full]
ENV Testbed=
ENV arr=
# ENV device=
# ENV id=
COPY . /scan
ENTRYPOINT ["python3", "main.py"]
I want to pip install this particular packages locally Like from a tar files. I want to build the image without any internet, so that's why I need it to be locally so that the pip will take them from local and not from internet. I just want to clarify that when I pip install requirements it will go anyway to the internet, I already try it.
You need base image in dockerfiles:
# Set the base image
FROM python:3.8
# Set the working directory
WORKDIR /scan
# Copy the local tar files into the image
COPY your_package1.tar.gz your_package2.tar.gz /tmp/
# Install packages from local tar files
RUN pip install /tmp/your_package1.tar.gz && \
pip install /tmp/your_package2.tar.gz
# Set environment variables if needed
ENV Testbed=
ENV arr=
# Copy the rest of your application files
COPY . /scan
# Specify the entry point
ENTRYPOINT ["python3", "main.py"]
For running any commands in the process of building docker image (keyword RUN):
# Install system packages using apt-get
RUN apt-get update && \
apt-get install -y openssh-server apache2 supervisor