diff --git a/docker-compose.yml b/docker-compose.yml index bf94e2c..93a15d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,9 @@ web: restart: always build: ./web expose: - - "6543" + - "80" ports: - - "6543:6543" + - "6543:80" links: - postgres:postgres volumes: @@ -17,19 +17,15 @@ web: nginx: restart: always - build: ./nginx/ + build: ./nginx ports: - - "80:80" - volumes: - - /www/static - volumes_from: - - web + - "8005:80" links: - web:web postgres: restart: always - image: ./postgres + build: ./postgres volumes: - pgdata:/var/lib/postgresql/data expose: diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..0eb3906 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:latest +MAINTAINER tanshu + +COPY brew.conf /etc/nginx/conf.d/default.conf diff --git a/nginx/brew.conf b/nginx/brew.conf new file mode 100644 index 0000000..762f4ca --- /dev/null +++ b/nginx/brew.conf @@ -0,0 +1,13 @@ +server { + + listen 80; + server_name example.org; + charset utf-8; + + location / { + proxy_pass http://web:80; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} diff --git a/up.sh b/up.sh new file mode 100755 index 0000000..49f5ec9 --- /dev/null +++ b/up.sh @@ -0,0 +1,3 @@ +docker volume create --name pgdata +docker-compose build +docker-compose up -d diff --git a/web/Dockerfile b/web/Dockerfile index e682ad5..aa2af78 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -4,9 +4,11 @@ MAINTAINER tanshu ENV PYTHONUNBUFFERED 1 -RUN git clone http://git.tanshu.com/tanshu/brewman.git \ +RUN git clone --depth=1 http://git.tanshu.com/tanshu/brewman.git \ && pip install -r brewman/requirements.txt WORKDIR /brewman -CMD /usr/local/bin/pserver /brewman/container.ini +RUN python setup.py install + +CMD /usr/local/bin/pserve /brewman/container.ini diff --git a/web/Dockerfile.local b/web/Dockerfile.local new file mode 100644 index 0000000..c6ce223 --- /dev/null +++ b/web/Dockerfile.local @@ -0,0 +1,15 @@ +FROM python:3 + +MAINTAINER tanshu + +ENV PYTHONUNBUFFERED 1 + +COPY src /brewman + +WORKDIR /brewman + +RUN pip install -r requirements.txt +RUN python setup.py install + +CMD /usr/local/bin/pserve /brewman/container.ini +