I’m running a python script to manipulate pictures. When I run the test the system obviously does not find the images. I new to docker and don’t really understand how to do that.
This is how the structure looks
And this is the dockerfile
FROM ubuntu:latest
RUN apt update
RUN apt install python3 -y
RUN apt-get -y install python3-pip
RUN pip install pillow
RUN pip install wand
RUN DEBIAN_FRONTEND="noninteractive" apt-get install libmagickwand-dev --no-install-recommends -y
WORKDIR /usr/app/src
COPY image_converter.py ./
COPY test_image_converter.py ./
RUN python3 -m unittest test_image_converter.py
3
Answers
here you’ve COPIED
****.py
file to./
(==WORKDIR
)so, in the same way copy your image files to your
WORKDIR
such as
This should work
IDK if this will help, but try to look its content.
https://www.geeksforgeeks.org/copying-files-to-and-from-docker-containers/
First, you didn’t copy the image folder, should have these commands:
WORKDIR /usr/app/src
COPY test_images ./
Second, you should combine same type of Docker commands (to reduce layers, hence reduce docker image’s size)
example : instead of saying
COPY image_converter.py ./
COPY test_image_converter.py ./
You can write
Another example :
RUN apt update
RUN apt install python3 -y
You can write