Skip to content

Commit

Permalink
Corrige Dockerfile
Browse files Browse the repository at this point in the history
O Dockerfile estava desconsiderando as dependências concretas, definidas
no arquivo `requirements.txt` e instalando-as a partir das declarações
abstratas do módulo `setup.py`, o que causava falta de determinismo na
criação das imagens.

Esta mudança corrige o ponto mencionado e faz ainda outras melhorias,
como o desligamento do buffer de IO do interpretador Python, definição
de usuário do processo e criação de de `docker-compose.yml` de exemplo
para execução local.
  • Loading branch information
Gustavo Fonseca authored and gustavofonseca committed Mar 23, 2020
1 parent 28724e1 commit 30c6037
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.5.2
ENV PYTHONUNBUFFERED 1

MAINTAINER [email protected]

Expand All @@ -9,10 +10,14 @@ COPY production.ini-TEMPLATE /app/config.ini

WORKDIR /app

RUN pip install --upgrade pip
RUN pip install gunicorn
RUN pip install --upgrade deps/scielojcr-1.3.0-py2.py3-none-any.whl
RUN pip install --upgrade pip && \
pip install gunicorn && \
pip install --upgrade deps/scielojcr-1.3.0-py2.py3-none-any.whl && \
pip install -r requirements.txt && \
python setup.py install

ENV ANALYTICS_SETTINGS_FILE=/app/config.ini

RUN python setup.py install
USER nobody

CMD ["gunicorn", "--paste", "/app/config.ini", "-b", "0.0.0.0", "--forwarded-allow-ips", "*"]
13 changes: 9 additions & 4 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.5.2
ENV PYTHONUNBUFFERED 1

MAINTAINER [email protected]

Expand All @@ -9,10 +10,14 @@ COPY development.ini-TEMPLATE /app/config.ini

WORKDIR /app

RUN pip install --upgrade pip
RUN pip install gunicorn
RUN pip install --upgrade deps/scielojcr-1.3.0-py2.py3-none-any.whl
RUN pip install --upgrade pip && \
pip install gunicorn && \
pip install --upgrade deps/scielojcr-1.3.0-py2.py3-none-any.whl && \
pip install -r requirements.txt && \
python setup.py install

ENV ANALYTICS_SETTINGS_FILE=/app/config.ini

RUN python setup.py develop
USER nobody

CMD ["gunicorn", "--paste", "/app/config.ini", "-b", "0.0.0.0", "--forwarded-allow-ips", "*"]
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '2'

services:
memcached:
image: memcached
restart: always
webapp:
build:
context: .
dockerfile: ./Dockerfile
user: nobody
restart: always
depends_on:
- memcached
ports:
- "8000:8000"
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requests==2.11.1
requests==2.19.1
cython==0.22
thriftpy==0.3.1
pyramid==1.5.7
Expand All @@ -16,4 +16,3 @@ publicationstatsapi==1.2.0
articlemetaapi==1.14.19
altmetric==1.0.0
-e git+https://github.com/scieloorg/[email protected]#egg=thriftpywrap
-e git+https://github.com/scieloorg/[email protected]#egg=analytics

0 comments on commit 30c6037

Please sign in to comment.