backend/Dockerfile
2022-10-31 09:23:18 +01:00

35 lines
896 B
Docker

FROM python:3.10.0-bullseye AS builder
# create user and group
RUN mkdir -p /home/app
RUN adduser app && adduser app app
WORKDIR /home/app
# install dependencies
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y postgresql gcc python3-dev \
libgl1
#musl-dev libxml2-dev libxslt-dev
COPY ./requirements.txt .
RUN python3 -m pip install --upgrade pip && \
pip3 install -r requirements.txt && \
pip3 install psycopg2==2.9.4 && \
pip3 install gunicorn==20.1.0
COPY . .
RUN chown -R app:app /home/app
USER app
FROM builder AS backend
# run gunicorn
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000"]
FROM builder AS worker
# run celery worker
CMD ["celery", "-A", "config", "worker", "-l", "info"]
FROM builder AS websocket
# run daphne server
CMD ["daphne", "-b", "0.0.0.0", "-p", "8001", "config.asgi:application"]