Skip to content

Instantly share code, notes, and snippets.

@epicserve
Forked from jefftriplett/.dockerignore
Last active December 27, 2017 22:58
Show Gist options
  • Save epicserve/614c4a81e9d714277bb073edaf49045f to your computer and use it in GitHub Desktop.
Save epicserve/614c4a81e9d714277bb073edaf49045f to your computer and use it in GitHub Desktop.

Revisions

  1. epicserve revised this gist Dec 27, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ version: '2'
    services:

    postgres:
    container_name: YOUR-PROJECT-postgres-db
    container_name: oakgrove-postgres-db
    restart: always
    image: postgres:latest
    ports:
    @@ -15,7 +15,7 @@ services:
    image: redis:3.0

    web:
    container_name: YOUR-PROJECT-web
    container_name: oakgrove-web
    build:
    context: .
    dockerfile: Dockerfile
    @@ -29,7 +29,6 @@ services:
    env_file: .env-docker
    volumes:
    - .:/src
    # command: /gunicorn.sh

    volumes:
    postgres_data:
  2. epicserve revised this gist Dec 27, 2017. 5 changed files with 47 additions and 36 deletions.
    9 changes: 6 additions & 3 deletions .env-docker.sample
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    DEBUG=true
    DEBUG=on
    SECRET_KEY='*******************************'
    DATABASE_URL=postgres://postgres@postgres/postgres
    SECRET_KEY=HAVE-IT-YOUR-WAY
    DJANGO_ADMIN_URL=/admin/
    EMAIL_HOST='smtp.gmail.com'
    EMAIL_HOST_USER='[email protected]'
    EMAIL_HOST_PASSWORD='*************'
    DEFAULT_FROM_EMAIL="Brent O'Connor <[email protected]>"
    8 changes: 5 additions & 3 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    FROM python:3.6.1
    FROM python:3.6.3

    # This prevents Python from writing out pyc files
    ENV PYTHONDONTWRITEBYTECODE 1
    @@ -10,12 +10,14 @@ EXPOSE 8000

    WORKDIR /src

    COPY requirements.txt /src/requirements.txt
    COPY Pipfile /src/Pipfile
    COPY Pipfile.lock /src/Pipfile.lock

    RUN mkdir -p /src/assets \
    && mkdir -p /src/logs \
    && chmod 755 /src \
    && pip install --no-cache-dir -r /src/requirements.txt
    && pip install pipenv \
    && cd /src && pipenv install --dev --deploy --system

    COPY . /src/

    36 changes: 36 additions & 0 deletions Pipfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    [[source]]

    name = "pypi"
    verify_ssl = true
    url = "https://pypi.python.org/simple"


    [requires]

    python_full_version = "3.6.3"


    [dev-packages]

    "fabric3" = "<1.14,>=1.13.1.post1"
    "flake8" = "<3.6,>=3.5.0"
    coverage = "<4.5,>=4.4.2"
    django-debug-toolbar = "<1.10,>=1.9.1"
    ipdb = "<0.11,>=0.10.3"
    ipython = "<6.3,>=6.2.1"
    isort = "<4.3,>=4.2.15"
    sphinx-autobuild = "<0.8,>=0.7.1"
    sphinx-rtd-theme = "<0.3,>=0.2.4"


    [packages]

    "psycopg2" = "<2.8,>=2.7.3.2"
    django = "<2.0,>=1.11"
    django-allauth = "<0.35,>=0.34.0"
    django-bootstrap-form = "<3.4,>=3.3"
    django-compressor = "<2.3,>=2.2"
    django-environ = "<0.5,>=0.4.4"
    gunicorn = "<19.8,>=19.7.1"
    dj-static = "<0.1,>=0.0.6"
    wagtail = "*"
    12 changes: 0 additions & 12 deletions docker-entrypoint.sh
    Original file line number Diff line number Diff line change
    @@ -7,15 +7,3 @@ python manage.py migrate --noinput
    python manage.py collectstatic --noinput

    python manage.py runserver 0.0.0.0:8000

    # Start Gunicorn processes
    #echo Starting Gunicorn.

    #exec gunicorn app.wsgi:application \
    # --name app \
    # --bind 0.0.0.0:80 \
    # --workers 3 \
    # --log-level=info \
    # --log-file=/src/logs/gunicorn.log \
    # --access-logfile=/src/logs/access.log \
    # "$@"
    18 changes: 0 additions & 18 deletions requirements.txt
    Original file line number Diff line number Diff line change
    @@ -1,18 +0,0 @@
    Django
    django-environ
    whitenoise

    # Postgres
    psycopg2

    # Redis
    django-redis
    redis

    # for production
    gunicorn

    # for testing
    pytest
    pytest-django
    pytest-sugar
  3. @jefftriplett jefftriplett renamed this gist Dec 27, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @jefftriplett jefftriplett renamed this gist Apr 21, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. @jefftriplett jefftriplett revised this gist Apr 21, 2017. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    Django
    django-environ
    whitenoise

    # Postgres
    psycopg2

    # Redis
    django-redis
    redis

    # for production
    gunicorn

    # for testing
    pytest
    pytest-django
    pytest-sugar
  6. @jefftriplett jefftriplett created this gist Apr 21, 2017.
    4 changes: 4 additions & 0 deletions .dockerignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    .*
    !.coveragerc
    !.env
    !.pylintrc
    4 changes: 4 additions & 0 deletions .env-docker.sample
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    DEBUG=true
    DATABASE_URL=postgres://postgres@postgres/postgres
    SECRET_KEY=HAVE-IT-YOUR-WAY
    DJANGO_ADMIN_URL=/admin/
    22 changes: 22 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    FROM python:3.6.1

    # This prevents Python from writing out pyc files
    ENV PYTHONDONTWRITEBYTECODE 1

    # This keeps Python from buffering stdin/stdout
    ENV PYTHONUNBUFFERED 1

    EXPOSE 8000

    WORKDIR /src

    COPY requirements.txt /src/requirements.txt

    RUN mkdir -p /src/assets \
    && mkdir -p /src/logs \
    && chmod 755 /src \
    && pip install --no-cache-dir -r /src/requirements.txt

    COPY . /src/

    CMD ["/src/docker-entrypoint.sh", "-n"]
    35 changes: 35 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    version: '2'

    services:

    postgres:
    container_name: YOUR-PROJECT-postgres-db
    restart: always
    image: postgres:latest
    ports:
    - "5432:5432"
    volumes:
    - postgres_data:/var/lib/postgresql/data/

    redis:
    image: redis:3.0

    web:
    container_name: YOUR-PROJECT-web
    build:
    context: .
    dockerfile: Dockerfile
    # user: django
    depends_on:
    - postgres
    - redis
    restart: always
    ports:
    - "8000:8000"
    env_file: .env-docker
    volumes:
    - .:/src
    # command: /gunicorn.sh

    volumes:
    postgres_data:
    21 changes: 21 additions & 0 deletions docker-entrypoint.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/bash

    # apply database migrations
    python manage.py migrate --noinput

    # collect static files
    python manage.py collectstatic --noinput

    python manage.py runserver 0.0.0.0:8000

    # Start Gunicorn processes
    #echo Starting Gunicorn.

    #exec gunicorn app.wsgi:application \
    # --name app \
    # --bind 0.0.0.0:80 \
    # --workers 3 \
    # --log-level=info \
    # --log-file=/src/logs/gunicorn.log \
    # --access-logfile=/src/logs/access.log \
    # "$@"