Skip to content

Commit

Permalink
docker: configuration improvements
Browse files Browse the repository at this point in the history
* Improves Docker configuration to speed up the build process by
  profiting from cache, to use the current user identity instead of
  root, and to run the simple example application as is done in
  `docker-compose`.

  Example session:

    $ docker-compose build
    $ docker-compose up
    $ firefox http://0.0.0.0:5000/
    $ docker-compose run web python setup.py test

Signed-off-by: Tibor Simko <tibor.simko@cern.ch>
  • Loading branch information
tiborsimko committed Mar 16, 2015
1 parent 0d387ca commit 495b2c6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,31 @@
# it under the terms of the Revised BSD License; see LICENSE file for
# more details.

# Use Python-2.7:
FROM python:2.7
ADD . /code

# Install some prerequisites ahead of `setup.py` in order to profit
# from the docker build cache:
RUN pip install 'coverage<4.0a1' \
flask \
pep257 \
pytest \
pytest-cov \
pytest-pep8 \
sphinx

# Add sources to `code` and work there:
WORKDIR /code
RUN pip install pep257
RUN pip install sphinx
RUN python setup.py develop
ADD . /code

# Install Flask-Menu:
RUN pip install -e .[docs]

# Run container as user `flaskmenu` with UID `1000`, which should match
# current host user in most situations:
RUN adduser --uid 1000 --disabled-password --gecos '' flaskmenu && \
chown -R flaskmenu:flaskmenu /code

# Start simple example application:
USER flaskmenu
CMD ["python", "examples/simple/app.py"]
File renamed without changes.

0 comments on commit 495b2c6

Please sign in to comment.