diff --git a/src/djinit/templates/project/Dockerfile-tpl b/src/djinit/templates/project/Dockerfile-tpl new file mode 100644 index 0000000..d61ebe4 --- /dev/null +++ b/src/djinit/templates/project/Dockerfile-tpl @@ -0,0 +1,44 @@ +FROM python:3.13-slim + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +ENV PIP_NO_CACHE_DIR=1 +ENV PIP_DISABLE_PIP_VERSION_CHECK=1 + +WORKDIR /app + +# @IF database_type == 'mysql' +RUN apt-get update && apt-get install -y --no-install-recommends \ + default-libmysqlclient-dev \ + build-essential \ + && rm -rf /var/lib/apt/lists/* +# @ELSE +RUN apt-get update && apt-get install -y --no-install-recommends \ + libpq-dev \ + && rm -rf /var/lib/apt/lists/* +# @ENDIF + +# @IF use_tailwind +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + && rm -rf /var/lib/apt/lists/* +ENV NODE_VERSION=20 +RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ + && apt-get install -y nodejs \ + && rm -rf /var/lib/apt/lists/* +# @ENDIF + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# @IF use_tailwind +RUN python manage.py tailwind install +# @ENDIF + +COPY . . + +RUN python manage.py collectstatic --noinput || true + +EXPOSE 8000 + +CMD ["gunicorn", "[[ module_name ]].wsgi:application", "--bind", "0.0.0.0:8000"] \ No newline at end of file diff --git a/src/djinit/templates/project/dockerignore-tpl b/src/djinit/templates/project/dockerignore-tpl new file mode 100644 index 0000000..505d698 --- /dev/null +++ b/src/djinit/templates/project/dockerignore-tpl @@ -0,0 +1,26 @@ +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +*.so +.venv +venv +ENV +.env +.git +.gitignore +*.md +README* +LICENSE +.coverage +htmlcov +.pytest_cache +.mypy_cache +.ruff_cache +.DS_Store +node_modules +*.log +db.sqlite3 +media +staticfiles \ No newline at end of file