Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829303132# Use the official Python base imageFROM python:3.9# Set the working directory in the containerWORKDIR /app# Copy the requirements.txt file and install the Python dependenciesCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# Set up a new user named "user" with user ID 1000RUN useradd -m -u 1000 user# Switch to the "user" userUSER user# Set home to the user's home directoryENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH# Set the working directory to the user's home directoryWORKDIR $HOME/app# Copy the current directory contents into the container at $HOME/app setting the owner to the userCOPY --chown=user . $HOME/app# Expose the port on which the Flask application will runEXPOSE 5000# Set the environment variable for FlaskENV FLASK_APP=api_server.py# Run the Flask applicationCMD ["flask", "run", "--host=0.0.0.0"]12345678910111213FROM python:3.9WORKDIR /codeCOPY ./requirements.txt /code/requirements.txtRUN pip install --no-cache-dir -r /code/requirements.txtCOPY . .# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]CMD python app.py
Dockerfile+6-25