forked from Incharajayaram/radarvision-webpage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (31 loc) · 1.06 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Use a smaller base image for the build stage
FROM python:3.9-slim as build
# Set the working directory
WORKDIR /app
# Copy only the necessary files
COPY requirements.txt ./
# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc curl \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch==2.3.1 torchvision==0.18.1 --index-url https://download.pytorch.org/whl/cpu \
&& apt-get remove -y gcc \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the rest of the application files
COPY . .
# Download the model
RUN MODEL_PATH="best_model_CustomVGG.pt" && \
if [ ! -f "$MODEL_PATH" ]; then \
echo "Downloading model from $MODEL_URL..."; \
curl -o "$MODEL_PATH" "$MODEL_URL"; \
else \
echo "Model already exists at $MODEL_PATH, skipping download."; \
fi
# Install Gunicorn
RUN pip install gunicorn
# Expose the port
EXPOSE 5000
# Start the Gunicorn server
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app", "--w=2"]