Skip to content
This repository has been archived by the owner on Feb 28, 2018. It is now read-only.

Setup a new way to compose containers #137

Closed
wants to merge 13 commits into from
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
FROM python:3.5
COPY requirements.txt /requirements.txt

RUN echo "America/Sao_Paulo" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata

RUN apt-get update && apt-get install -y \
postgresql \
postgresql-contrib

RUN python -m pip install -U pip

COPY requirements.txt /requirements.txt

RUN python -m pip install -r requirements.txt
RUN apt-get update && apt-get install -y postgresql postgresql-contrib
COPY .env /code/.env
COPY manage.py /code/manage.py
COPY jarbas /code/jarbas

COPY ./ /code
WORKDIR /code
RUN echo "America/Sao_Paulo" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
VOLUME /code/staticfiles

CMD ["gunicorn", "jarbas.wsgi:application", "--reload", "--bind", "0.0.0.0:8001", "--workers", "4"]
11 changes: 6 additions & 5 deletions Dockerfile-elm
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM node:6.9.1

RUN npm install -g yarn

COPY ./ /code
WORKDIR /code
COPY elm-package.json elm-package.json
COPY package.json package.json
COPY gulpfile.js gulpfile.js
RUN yarn install
COPY jarbas jarbas

RUN yarn

CMD yarn assets
2 changes: 1 addition & 1 deletion Dockerfile-nginx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM nginx:1.11.5

COPY contrib/nginx.docker /etc/nginx/conf.d/default.conf
RUN mkdir -p /opt/jarbas
2 changes: 1 addition & 1 deletion contrib/nginx.docker
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ server {
access_log on;

location /static/ {
alias /opt/jarbas/staticfiles/;
alias /code/staticfiles/;
}

location / {
Expand Down
27 changes: 14 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
version: '2'
services:

jarbas:
build:
context: .
dockerfile: Dockerfile
volumes:
- "staticfiles:/code/staticfiles"
- "./:/code"
- "staticfiles:/code/staticfiles"
- "assets:/code/jarbas/frontend/static"
environment:
- SECRET_KEY=lets-rock
- DATABASE_URL=postgres://jarbas:mysecretpassword@db/jarbas
- CACHE_BACKEND=django.core.cache.backends.memcached.MemcachedCache
- CACHE_LOCATION=cache:11211
- DEBUG=True
- SECRET_KEY=lets-rock
- DATABASE_URL=postgres://jarbas:mysecretpassword@db/jarbas
- CACHE_BACKEND=django.core.cache.backends.memcached.MemcachedCache
- CACHE_LOCATION=cache:11211
- DEBUG=True
depends_on:
- elm
- db
- cache
- elm
- db
- cache
networks:
backend:
frontend:
Expand All @@ -28,15 +29,15 @@ services:
context: .
dockerfile: Dockerfile-elm
volumes:
- "./:/code"
- "assets:/code/jarbas/frontend/static"
command: [npm, run, watch]
- "staticfiles:/code/jarbas/frontend/static"

nginx:
build:
context: .
dockerfile: Dockerfile-nginx
volumes:
- "assets:/opt/jarbas/staticfiles"
- "staticfiles:/code/staticfiles"
ports:
- "8000:80"
depends_on:
Expand Down
12 changes: 12 additions & 0 deletions docker-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'
services:

jarbas:
volumes:
- "./:/code"

elm:
volumes:
- "./:/code"
- "/code/node_modules"
command: [yarn, watch]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ideia is keep development in default docker-compose file.