Untitled

mail@pastecode.io avatar
unknown
dockerfile
a month ago
816 B
4
Indexable
Never
# Use an official Python runtime as a parent image
FROM python:3.9-slim-buster

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set work directory

# Install system dependencies
RUN apt-get update \
    && apt-get install -y build-essential python3-dev python3-pip \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install pipenv
RUN pip install --upgrade pip \
    && pip install pipenv

# Copy the Pipfile first, for better caching
COPY ./Pipfile /Pipfile
COPY ./Pipfile.lock /Pipfile.lock

# Install python dependencies
RUN pipenv install --system --deploy

# Copy project
COPY . .

# Expose the port that the app runs in
EXPOSE 8080

# Start the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
Leave a Comment