32 lines
741 B
Docker
32 lines
741 B
Docker
FROM python:3.9-slim
|
|
|
|
ARG DB_ENGINE=sqlite
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& if [ "$DB_ENGINE" = "postgres" ]; then \
|
|
apt-get install -y libpq-dev; \
|
|
fi \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& if [ "$DB_ENGINE" = "postgres" ]; then \
|
|
pip install psycopg2-binary; \
|
|
fi
|
|
|
|
COPY /src/requirements.txt .
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
RUN if [ "$DB_ENGINE" = "sqlite" ]; then \
|
|
mkdir -p /data/db; \
|
|
fi
|
|
|
|
RUN mkdir -p /data/db
|
|
COPY src/ ./src/
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000"]
|