21 lines
513 B
Docker
21 lines
513 B
Docker
# Use an official lightweight Python image
|
|
FROM python:3.8-slim
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Copy the application code into the container
|
|
COPY app.py /app/
|
|
|
|
# Install required Python packages: Flask and MySQL connector
|
|
RUN pip install flask mysql-connector-python
|
|
|
|
# Expose port 5000 for the Flask app
|
|
EXPOSE 5000
|
|
|
|
# Set the environment variable for Flask
|
|
ENV FLASK_APP=app.py
|
|
|
|
# Run the Flask application
|
|
CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"]
|