Fantastisk
Fantastisk
RRailway
Created by Fantastisk on 12/1/2023 in #✋|help
deploying fastapi with docker
Can't figure out how to make the app listen when deployed and assigned an url to. Works perfect when runned locally. dockerfile:
# Use Python image as base image
FROM python:3.11.6

# Set working directory in the container
WORKDIR /baseApp

# Copy the contents of the scraper directory to the container's /app directory
COPY . /baseApp

# Install project dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt

# Expose the port that FastAPI will run on
EXPOSE 8000

# Command to run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
# Use Python image as base image
FROM python:3.11.6

# Set working directory in the container
WORKDIR /baseApp

# Copy the contents of the scraper directory to the container's /app directory
COPY . /baseApp

# Install project dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt

# Expose the port that FastAPI will run on
EXPOSE 8000

# Command to run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
8 replies