Skip to content

Commit dba6e1b

Browse files
committed
check for dependency before pip install
Signed-off-by: Maysun J Faisal <[email protected]>
1 parent 67c7862 commit dba6e1b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docker/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ ENV FLASK_PORT=8081
77
# Set the working directory in the container
88
WORKDIR /projects
99

10-
# Copy the dependencies file to the working directory
11-
COPY requirements.txt .
12-
13-
# Install any dependencies
14-
RUN pip install -r requirements.txt
15-
1610
# Copy the content of the local src directory to the working directory
1711
COPY . .
1812

13+
# Install any dependencies
14+
RUN \
15+
if [ -f requirements.txt ]; \
16+
then pip install -r requirements.txt; \
17+
elif [ `ls -1q *.txt | wc -l` == 1 ]; \
18+
then pip install -r *.txt; \
19+
fi
20+
1921
# Specify the command to run on container start
2022
CMD [ "python", "." ]

0 commit comments

Comments
 (0)