From 5dcf327673fe7fac219b0dc49a565bde96bb312b Mon Sep 17 00:00:00 2001 From: Jezrien Hsieh Date: Fri, 15 Mar 2019 03:18:48 +0800 Subject: [PATCH] Update Dockerfile and docker-compose.yml Install missing dependencies --- Dockerfile | 13 +++++++++---- crm/settings.py | 4 ++-- docker-compose.yml | 9 ++++++--- entrypoint.sh | 5 +---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a3fa5b5..dd9f59c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,15 @@ FROM python:3.6 WORKDIR /app # Intall dependencies -COPY requirements.txt /app/ +COPY . /app/ -COPY . /app +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ + apt update && \ + apt install -y git ruby-dev nodejs && \ + gem install compass sass && \ + npm -g install less && \ + pip install -r requirements.txt && \ + pip install redis coveralls RUN chmod +x /app/entrypoint.sh -ENTRYPOINT ["/app/entrypoint.sh"] - +ENTRYPOINT ["/app/entrypoint.sh"] \ No newline at end of file diff --git a/crm/settings.py b/crm/settings.py index f91608ee..124f8caa 100644 --- a/crm/settings.py +++ b/crm/settings.py @@ -77,8 +77,8 @@ DATABASES = { 'NAME': 'dj_crm', 'USER': 'postgres', 'PASSWORD': 'root', - 'HOST': '127.0.0.1', - 'PORT': '5432' + 'HOST': os.getenv('DB_HOST', '127.0.0.1'), + 'PORT': os.getenv('DB_PORT', '5432') } } diff --git a/docker-compose.yml b/docker-compose.yml index e4f76d40..4bfbfeb6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,8 @@ version: '2.0' services: db: image: postgres - volumes: - - /home/db:/var/lib/postgresql/data + # volumes: + # - /home/db:/var/lib/postgresql/data environment: POSTGRES_PASSWORD: "root" POSTGRES_USER: "postgres" @@ -13,7 +13,10 @@ services: web: build: . image: micropyramid/django-crm:1 + environment: + DB_HOST: db + DB_PORT: 5432 ports: - "8001:8000" depends_on: - - db + - db \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 9d804679..6170403c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,6 @@ #!/bin/bash -# Install dependencies -pip install -r requirements.txt - # Execute startup scripts python manage.py collectstatic --noinput python manage.py migrate -python manage.py runserver 0.0.0.0:8000 +python manage.py runserver 0.0.0.0:8000 \ No newline at end of file