Dockerfile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. FROM debian:jessie
  2. ENV PYTHONIOENCODING UTF-8
  3. # Pypy is installed from a package manager because it takes so long to build.
  4. RUN apt-get update && apt-get install -y \
  5. build-essential \
  6. curl \
  7. git \
  8. libbz2-dev \
  9. libcurl4-openssl-dev \
  10. libmemcached-dev \
  11. libncurses5-dev \
  12. libreadline-dev \
  13. libsqlite3-dev \
  14. libssl-dev \
  15. pkg-config \
  16. pypy \
  17. wget \
  18. zlib1g-dev
  19. # Setup variables. Even though changing these may cause unnecessary invalidation of
  20. # unrelated elements, grouping them together makes the Dockerfile read better.
  21. ENV PROVISIONING /provisioning
  22. ARG CELERY_USER=developer
  23. # Check for mandatory build arguments
  24. RUN : "${CELERY_USER:?CELERY_USER build argument needs to be set and non-empty.}"
  25. ENV HOME /home/$CELERY_USER
  26. ENV PATH="$HOME/.pyenv/bin:$PATH"
  27. # Copy and run setup scripts
  28. WORKDIR $PROVISIONING
  29. COPY docker/scripts/install-couchbase.sh .
  30. # Scripts will lose thier executable flags on copy. To avoid the extra instructions
  31. # we call the shell directly.
  32. RUN sh install-couchbase.sh
  33. COPY docker/scripts/create-linux-user.sh .
  34. RUN sh create-linux-user.sh
  35. # Swap to the celery user so packages and celery are not installed as root.
  36. USER $CELERY_USER
  37. COPY docker/scripts/install-pyenv.sh .
  38. RUN sh install-pyenv.sh
  39. # Install celery
  40. WORKDIR $HOME
  41. COPY --chown=1000:1000 requirements $HOME/requirements
  42. COPY --chown=1000:1000 docker/entrypoint /entrypoint
  43. RUN chmod gu+x /entrypoint
  44. # Define the local pyenvs
  45. RUN pyenv local python2.7 python3.4 python3.5 python3.6
  46. # Setup one celery environment for basic development use
  47. RUN pyenv exec pip install \
  48. -r requirements/default.txt \
  49. -r requirements/pkgutils.txt \
  50. -r requirements/test.txt \
  51. -r requirements/test-ci-base.txt \
  52. -r requirements/test-integration.txt
  53. COPY --chown=1000:1000 MANIFEST.in Makefile setup.py setup.cfg tox.ini $HOME/
  54. COPY --chown=1000:1000 docs $HOME/docs
  55. COPY --chown=1000:1000 t $HOME/t
  56. COPY --chown=1000:1000 celery $HOME/celery
  57. RUN pyenv exec pip install -e .
  58. # Setup the entrypoint, this ensures pyenv is initialized when a container is started
  59. # and that any compiled files from earlier steps or from moutns are removed to avoid
  60. # py.test failing with an ImportMismatchError
  61. ENTRYPOINT ["/entrypoint"]