Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile improvements #171

Closed
LukasBommes opened this issue Mar 29, 2022 · 1 comment · Fixed by #172
Closed

Dockerfile improvements #171

LukasBommes opened this issue Mar 29, 2022 · 1 comment · Fixed by #172
Labels
Bug Something isn't working Docker Dev
Milestone

Comments

@LukasBommes
Copy link
Contributor

The provided Dockerfile does not work as expected. I had to change it as follows:

#########################################################
## Python Environment with CUDA
#########################################################

FROM nvidia/cuda:11.4-devel-ubuntu20.04 AS python_base_cuda
LABEL MAINTAINER="Anomalib Development Team"

# Setup Proxies
#ENV http_proxy=http://proxy-dmz.intel.com:912
#ENV https_proxy=http://proxy-dmz.intel.com:912
#ENV ftp_proxy=http://proxy-dmz.intel.com:912

# Update system and install wget
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y wget ffmpeg libpython3.8 git sudo

# Install Conda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh --quiet && \
    bash ~/miniconda.sh -b -p /opt/conda
ENV PATH "/opt/conda/bin:${PATH}"
RUN conda install python=3.8

#########################################################
## Anomalib Development Env
#########################################################

FROM python_base_cuda as anomalib_development_env

# Get MVTec Dataset
# cache datasets first as changes to requirements do no affect this stage
RUN wget ftp://guest:[email protected]/mvtec_anomaly_detection/mvtec_anomaly_detection.tar.xz --quiet && \
    mkdir -p /tmp/anomalib/datasets/MVTec && \
    tar -xf mvtec_anomaly_detection.tar.xz -C /tmp/anomalib/datasets/MVTec

# Install all anomalib requirements
COPY ./requirements/base.txt /tmp/anomalib/requirements/base.txt
RUN pip install -r /tmp/anomalib/requirements/base.txt

COPY ./requirements/openvino.txt /tmp/anomalib/requirements/openvino.txt
RUN pip install -r /tmp/anomalib/requirements/openvino.txt

# Install other requirements related to development
COPY ./requirements/dev.txt /tmp/anomalib/requirements/dev.txt
RUN pip install -r /tmp/anomalib/requirements/dev.txt

I.e. setup of proxies is not needed for end users and the line ENV PATH "/opt/conda/bin:${PATH}" && conda install python=3.8 in the Dockerfile lead to a corrupted path.

A further suggestion: You could download the dataset to the host in the entrypoint script, and then map that local dataset into the container. This would reduce image size and make sharing of the compiled image easier.

@samet-akcay
Copy link
Contributor

Thanks @LukasBommes for spotting it. Indeed, it has not been in use for a while, and a lot has been changed since then.

Would you like to create a PR for this to become a conributor?

@LukasBommes LukasBommes mentioned this issue Mar 29, 2022
11 tasks
@samet-akcay samet-akcay added Docker Dev Bug Something isn't working labels Apr 1, 2022
@samet-akcay samet-akcay added this to the v.0.2.6 milestone Apr 4, 2022
@samet-akcay samet-akcay linked a pull request Apr 5, 2022 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Docker Dev
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants