diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c05c4c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.5.7-alpine3.10 +RUN apk add git +WORKDIR /opt/catpol +COPY ./requirements* /opt/catpol/ +RUN pip3 install -r requirements-dev.txt +COPY . /opt/catpol +ENV DJANGO_SETTINGS_MODULE=project_template.settings.dev +RUN python3 manage.py migrate +CMD python3 manage.py runserver 0.0.0.0:8000 +EXPOSE 8000 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..54de169 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,58 @@ +version: "2" +services: + catpol: + build: . + depends_on: + - postgres + - pybossa + ports: + - "8000:8000" + redis-master: + image: 'redis:3.0-alpine' + redis-sentinel: + image: 'jvstein/redis-sentinel:latest' + depends_on: + - redis-master + links: + - redis-master + postgres: + image: 'postgres:9.6-alpine' + environment: + - POSTGRES_USER=pybossa + - POSTGRES_PASSWORD=XXXXXXXXXXXXXX + # initializes the database + db-init: + image: 'jvstein/pybossa:latest' + depends_on: + - postgres + environment: + - POSTGRES_URL=postgresql://pybossa:XXXXXXXXXXXXXX@db/pybossa + links: + - postgres:db + command: sh -c "sleep 5 && python cli.py db_create" + # background worker process + pybossa-bgworker: + image: 'jvstein/pybossa:latest' + depends_on: + - db-init + environment: + - POSTGRES_URL=postgresql://pybossa:XXXXXXXXXXXXXX@db/pybossa + links: + - redis-master + - redis-sentinel + - postgres:db + command: rqscheduler --host redis-master + # web server + pybossa: + image: 'jvstein/pybossa:latest' + container_name: pybossa + depends_on: + - db-init + environment: + - POSTGRES_URL=postgresql://pybossa:XXXXXXXXXXXXXX@db/pybossa + links: + - redis-master + - redis-sentinel + - postgres:db + ports: + - "8080:8080"