60 lines
1.9 KiB
Docker
60 lines
1.9 KiB
Docker
# Dockerfile
|
|
FROM python:3.9-slim-bookworm
|
|
ENV TZ="Asia/Tehran"
|
|
RUN ls /usr/share/zoneinfo && \
|
|
cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && \
|
|
echo "Asia/Tehran" > /etc/timezone && \
|
|
dpkg-reconfigure -f noninteractive tzdata
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# ساخت sources.list جدید با mirror ArvanCloud (برای سرعت در ایران)
|
|
RUN echo "deb http://mirror.arvancloud.ir/debian bookworm main" > /etc/apt/sources.list \
|
|
&& echo "deb-src http://mirror.arvancloud.ir/debian bookworm main" >> /etc/apt/sources.list \
|
|
&& echo "deb https://mirror.arvancloud.ir/debian-security bookworm-security main" >> /etc/apt/sources.list \
|
|
&& echo "deb-src https://mirror.arvancloud.ir/debian-security bookworm-security main" >> /etc/apt/sources.list \
|
|
&& echo "deb http://mirror.arvancloud.ir/debian bookworm-updates main" >> /etc/apt/sources.list \
|
|
&& echo "deb-src http://mirror.arvancloud.ir/debian bookworm-updates main" >> /etc/apt/sources.list
|
|
|
|
# Update + Install system deps (with apt cache)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libpq-dev \
|
|
python3-dev \
|
|
libcairo2 \
|
|
libcairo2-dev \
|
|
libpango-1.0-0 \
|
|
libpangoft2-1.0-0 \
|
|
libpangocairo-1.0-0 \
|
|
libpango1.0-dev \
|
|
libgdk-pixbuf-2.0-0 \
|
|
libffi-dev \
|
|
libjpeg-dev \
|
|
libpng-dev \
|
|
libfreetype6 \
|
|
libharfbuzz0b \
|
|
shared-mime-info \
|
|
fonts-dejavu \
|
|
curl \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Upgrade pip
|
|
RUN pip install --upgrade pip
|
|
|
|
# Copy requirements
|
|
COPY ./requirements.txt .
|
|
|
|
# Install Python dependencies با cache mount (سرعت pip رو بیشتر میکنه)
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project files
|
|
COPY . .
|
|
|
|
# Expose Django port
|
|
EXPOSE 8000
|
|
|
|
# Run Django development server
|
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|