-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile (deploy-python)
More file actions
32 lines (25 loc) · 1.02 KB
/
Dockerfile (deploy-python)
File metadata and controls
32 lines (25 loc) · 1.02 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
# Use the official Python image from the Docker Hub
FROM python:3.12.1
# Set the working directory in the container
WORKDIR /app
# Copy the ZIP file into the container
COPY ./python_api.zip /app/
# Install unzip, then unzip the application files, install Python dependencies,
# and clean up unnecessary files and packages in one RUN to keep the image clean and compact
RUN apt-get update && \
apt-get install -y unzip && \
unzip python_api.zip && \
rm python_api.zip && \
apt-get purge -y unzip && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app/python_api
# Install Python dependencies from the requirements file
# RUN pip install --no-cache-dir -r requirements.txt
RUN ls -la /app/python_api && pip install --no-cache-dir -r requirements.txt
# Expose the port the app runs on
EXPOSE 8088
# Define the command to run the app using Django's built-in server
CMD ["python", "manage.py", "runserver", "172.20.1.3:8088"]