MOHAMED.
// Source - Why am I getting "ERR_CONNECTION_REFUSED" when querying by sidecar-hosted backend in Azure App Service?
// Posted by chris
// Retrieved 11/4/2025, License - CC-BY-SA 4.0
FROM python:3.10-slim
RUN mkdir /backend
WORKDIR /backend
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED = 1
RUN pip install --upgrade pip --trusted-host pypi.org
COPY requirements.txt /backend/
RUN apt-get update && \
apt-get install -y libpq-dev gcc
RUN pip install --no-cache-dir -r requirements.txt --trusted-host pypi.org
COPY . /backend/
EXPOSE 8080 80
CMD ["daphne", "-b", "0.0.0.0", "-p", "8080", "backend.asgi:application"]