Verified Commit 6108b393 authored by Naveen's avatar Naveen 👽

Add support for local docker-compose

parent b82f6a84
FROM python:3.6-stretch
LABEL maintainer "Muhammad Kaisar Arkhan <yukinagato@protonmail.com>"
ENV USER=gitmate ROOT=/usr/src/app NUM_WORKERS=3 LOG_LEVEL=DEBUG TIMEOUT=30 MIN=3 MAX=10
ENV USER=gitmate \
ROOT=/usr/src/app \
NUM_WORKERS=3 \
LOG_LEVEL=DEBUG \
TIMEOUT=30 \
MIN=3 \
MAX=10 \
DB_HOST=db \
DB_PORT=5432
EXPOSE 8000
......@@ -28,7 +36,7 @@ RUN set -ex && \
\
apt-get update && \
apt-get install -y --no-install-recommends \
libpq5 git docker-ce $buildDeps && \
postgresql-client libpq5 git docker-ce $buildDeps && \
\
pip install --no-cache-dir -r $ROOT/requirements.txt && \
./install_deps.sh && \
......
version: '3'
services:
dind:
image: docker:stable-dind
privileged: true
db:
image: postgres:9.6
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
volumes:
- db_data:/var/lib/postgresql/data
rabbit:
image: rabbitmq:3.6
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=password
backend:
build: .
command: ./docker/run.dev.sh
ports:
- "8000:8000"
env_file: ./docker/environment
volumes:
- .:/usr/src/app
depends_on:
- db
worker:
build: .
command: ./docker/run-worker.sh
env_file: ./docker/environment
environment:
- DOCKER_HOST=tcp://dind:2375
volumes:
- .:/usr/src/app
depends_on:
- rabbit
- backend
- dind
beat:
build: .
command: ./docker/run-beat.sh
env_file: ./docker/environment
environment:
- DOCKER_HOST=tcp://dind:2375
volumes:
- .:/usr/src/app
depends_on:
- rabbit
- backend
- dind
volumes:
db_data: {}
......@@ -10,10 +10,11 @@ if [ ! -d "$BEAT_SCHEDULE_FOLDER" ]; then
chown $USER:$USER $BEAT_SCHEDULE_FOLDER
fi
echo "Starting celery beat scheduler..."
exec celery beat \
-A gitmate \
-s $BEAT_SCHEDULE_FILE \
--uid=$USER --gid=$USER \
--uid=$USER --gid=$USER \
--loglevel=info \
--pidfile=$BEAT_PID_FILE \
$EXTRA_ARGUMENTS
......@@ -39,6 +39,7 @@ else
echo "DOCKER_HOST is defined."
fi
echo "Starting celery worker..."
exec celery worker \
-A gitmate \
--uid=$USER --gid=$USER \
......
#!/bin/sh
echo "Waiting for database ..."
while ! pg_isready -h $DB_HOST -p $DB_PORT 2>/dev/null; do
sleep 1
done
echo "Creating cache table ..."
python3 manage.py createcachetable
echo "Starting debug server with live reload ..."
exec python3 manage.py runserver 0.0.0.0:8000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment