|
| 1 | +FROM buildpack-deps:wheezy |
| 2 | + |
| 3 | +### |
| 4 | +# Build and install Python |
| 5 | +### |
| 6 | + |
| 7 | +# remove several traces of debian python |
| 8 | +RUN apt-get purge -y python.* |
| 9 | + |
| 10 | +# http://bugs.python.org/issue19846 |
| 11 | +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. |
| 12 | +ENV LANG C.UTF-8 |
| 13 | + |
| 14 | +# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported |
| 15 | +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF |
| 16 | + |
| 17 | +ENV PYTHON_VERSION 2.7.12 |
| 18 | + |
| 19 | +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" |
| 20 | +ENV PYTHON_PIP_VERSION 8.1.2 |
| 21 | + |
| 22 | +RUN set -ex \ |
| 23 | + && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ |
| 24 | + && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ |
| 25 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 26 | + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ |
| 27 | + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ |
| 28 | + && rm -r "$GNUPGHOME" python.tar.xz.asc \ |
| 29 | + && mkdir -p /usr/src/python \ |
| 30 | + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ |
| 31 | + && rm python.tar.xz \ |
| 32 | + \ |
| 33 | + && cd /usr/src/python \ |
| 34 | + && ./configure --enable-shared --enable-unicode=ucs4 \ |
| 35 | + && make -j$(nproc) \ |
| 36 | + && make install \ |
| 37 | + && ldconfig \ |
| 38 | + && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ |
| 39 | + && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ |
| 40 | + && find /usr/local -depth \ |
| 41 | + \( \ |
| 42 | + \( -type d -a -name test -o -name tests \) \ |
| 43 | + -o \ |
| 44 | + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ |
| 45 | + \) -exec rm -rf '{}' + \ |
| 46 | + && rm -rf /usr/src/python ~/.cache |
| 47 | + |
| 48 | +# install "virtualenv", since the vast majority of users of this image will want it |
| 49 | +RUN pip install --no-cache-dir virtualenv |
| 50 | + |
| 51 | +### |
| 52 | +# Build and install Node.js |
| 53 | +### |
| 54 | + |
| 55 | +# gpg keys listed at https://github.com/nodejs/node |
| 56 | +RUN set -ex \ |
| 57 | + && for key in \ |
| 58 | + 9554F04D7259F04124DE6B476D5A82AC7E37093B \ |
| 59 | + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ |
| 60 | + 0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \ |
| 61 | + FD3A5288F042B6850C66B31F09FE44734EB7990E \ |
| 62 | + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ |
| 63 | + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ |
| 64 | + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ |
| 65 | + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ |
| 66 | + ; do \ |
| 67 | + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ |
| 68 | + done |
| 69 | + |
| 70 | +ENV NPM_CONFIG_LOGLEVEL info |
| 71 | +ENV NODE_VERSION 6.5.0 |
| 72 | + |
| 73 | +RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \ |
| 74 | + && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ |
| 75 | + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ |
| 76 | + && grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ |
| 77 | + && tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \ |
| 78 | + && rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt |
| 79 | + |
| 80 | +### |
| 81 | +# This adds fs-extra to npm and replaces the fs.rename method with the fs.extra move method |
| 82 | +# that now automatic chooses what to do (rename/move) |
| 83 | +# https://github.com/npm/npm/issues/9863 |
| 84 | +### |
| 85 | + |
| 86 | +RUN cd $(npm root -g)/npm \ |
| 87 | + && npm install fs-extra \ |
| 88 | + && sed -i -e s/graceful-fs/fs-extra/ -e s/fs.rename/fs.move/ ./lib/utils/rename.js |
| 89 | + |
| 90 | +### |
| 91 | +# Install build tools |
| 92 | +### |
| 93 | + |
| 94 | +# Install packages |
| 95 | +RUN apt-get update -y -q && \ |
| 96 | + apt-get install --no-install-recommends -y \ |
| 97 | + zip unzip \ |
| 98 | + && rm -rf /var/lib/apt/lists/* |
| 99 | + |
| 100 | + |
| 101 | +### |
| 102 | +# Install boto3 globally |
| 103 | +### |
| 104 | + |
| 105 | +RUN pip install boto3 |
| 106 | + |
| 107 | +### |
| 108 | +# Install Gulp and JSPM globally |
| 109 | + |
| 110 | +RUN npm install gulp -g |
| 111 | +RUN npm install jspm -g |
0 commit comments