docker python3.7 dockerfile
时间: 2023-10-11 18:05:52 浏览: 103
Here is an example Dockerfile for building a Python 3.7 container:
```
# Use the official Python image as the base image
FROM python:3.7
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
# Make port 80 available to the world outside this container
EXPOSE 80
# Define environment variable
ENV NAME World
# Run app.py when the container launches
CMD ["python", "app.py"]
```
This Dockerfile assumes that you have a `requirements.txt` file that lists all the Python packages your app needs to run. You should replace `app.py` with the name of the main Python file for your application. To build the container, run `docker build -t my-python-app .` in the directory where your Dockerfile and app files are located.
阅读全文