40 lines
874 B
Docker
40 lines
874 B
Docker
# Pull base image
|
|
FROM python:3.12.2-bookworm
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
# Create and set work directory called `app`
|
|
RUN mkdir -p /code
|
|
WORKDIR /code
|
|
|
|
# Install dependencies
|
|
COPY requirements.txt /tmp/requirements.txt
|
|
|
|
RUN set -ex && \
|
|
pip install --upgrade pip && \
|
|
pip install -r /tmp/requirements.txt && \
|
|
rm -rf /root/.cache/
|
|
|
|
# Copy local project
|
|
COPY . /code/
|
|
COPY .env.production /code/.env
|
|
ENV HOME=/code
|
|
|
|
# Install NPM & node.js
|
|
RUN apt-get update && apt-get install -y nodejs npm xvfb
|
|
|
|
RUN playwright install-deps && playwright install
|
|
|
|
# Expose port 8000
|
|
EXPOSE 8000
|
|
|
|
#USER 10003:10003
|
|
|
|
RUN python manage.py collectstatic --noinput
|
|
|
|
#RUN python manage.py createcachetable django_cache
|
|
|
|
# Use gunicorn on port 8000
|
|
CMD ["gunicorn", "--bind", ":8000", "django_project.wsgi", "--timeout", "300"]
|