sathish2352/compiler
0
1 2FROM python:3.9-slim3 4# 2. Set the working directory inside the container5# This is where our application code will live.6WORKDIR /code7 8# 3. Copy the requirements file into the container at /code9# We copy this first to leverage Docker's layer caching.10# If requirements.txt doesn't change, Docker won't reinstall dependencies on subsequent builds.11COPY ./requirements.txt /code/requirements.txt12 13# 4. Install any needed packages specified in requirements.txt14RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt15 16# 5. Copy the rest of the application's code into the container at /code17COPY ./app.py /code/app.py18 19# 6. Expose the port the app runs on20# FastAPI with Uvicorn defaults to port 8000.21EXPOSE 800022 23# 7. Define the command to run the application24# This command starts the Uvicorn server.25# --host 0.0.0.0 makes the server accessible from outside the container.26# --port 8000 matches the exposed port.27# app:app refers to the 'app' object inside the 'app.py' file.28CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]29 