Skip to content

Instantly share code, notes, and snippets.

@xzyfer
Created June 12, 2016 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xzyfer/fa8889f8fa8a279033889cb85f50e2b0 to your computer and use it in GitHub Desktop.
Save xzyfer/fa8889f8fa8a279033889cb85f50e2b0 to your computer and use it in GitHub Desktop.
Dockerfile for generation node-sass linux release binaries
#######
# Running:
# --------
# docker build --tag node-sass-binaries .
# docker run node-sass-binaries cat /node-sass/binaries.tar.gz > binaries.tar.gz
#######
FROM centos:5
### setup ###
RUN yum install -y curl wget make file which
RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
#RUN curl -SL https://rpm.nodesource.com/setup | bash -
RUN printf \
"[devtools-32]\n\
name=CentOS 5 devtools 32bit\n\
baseurl=http://people.centos.org/tru/devtools-2/5/i386/RPMS\n\
gpgcheck=0\n" > \
/etc/yum.repos.d/devtools32.repo
RUN printf \
"[devtools-64]\n\
name=CentOS 5 devtools 64bit\n\
baseurl=http://people.centos.org/tru/devtools-2/5/x86_64/RPMS\n\
gpgcheck=0\n" >\
/etc/yum.repos.d/devtools64.repo
RUN yum install -y devtoolset-2-{gcc,gcc-c++,binutils} git python26
RUN yum install -y glibc-devel.i386 devtoolset-2-libstdc++-devel.i386
ENV PATH /opt/rh/devtoolset-2/root/usr/bin:$PATH
### python ###
RUN mv /usr/bin/python /usr/bin/python_ && mv /usr/bin/python26 /usr/bin/python
ENV PATH /opt/centos/devtoolset-1.0/root/usr/bin:$PATH
### install nvm ###
RUN mkdir ~/.nvm
RUN wget --no-check-certificate -O ~/.nvm/nvm.sh https://raw.githubusercontent.com/xzyfer/nvm/master/nvm.sh
RUN cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak
RUN wget --no-check-certificate -O /etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem
### make nvm work for iojs ###
RUN echo insecure >> ~/.curlrc
### install x64 node versions ###
RUN source ~/.nvm/nvm.sh && true && nvm ls-remote
RUN source ~/.nvm/nvm.sh && nvm install v0 && \
source ~/.nvm/nvm.sh && nvm install v0.10 && \
source ~/.nvm/nvm.sh && nvm install iojs-v1 && \
source ~/.nvm/nvm.sh && nvm install iojs-v2 && \
source ~/.nvm/nvm.sh && nvm install iojs-v3 && \
source ~/.nvm/nvm.sh && nvm install iojs-v1.0 && \
source ~/.nvm/nvm.sh && nvm install 4 && \
source ~/.nvm/nvm.sh && nvm install 5 && \
source ~/.nvm/nvm.sh && nvm install 6
### now manually install x86 node versions ###
RUN source ~/.nvm/nvm.sh && \
wget http://nodejs.org/dist/v0.10.44/node-v0.10.44-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/node -xvf node-v0.10.44-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget http://nodejs.org/dist/v0.12.13/node-v0.12.13-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/node -xvf node-v0.12.13-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://iojs.org/dist/v1.0.4/iojs-v1.0.4-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/io.js -xvf iojs-v1.0.4-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://iojs.org/dist/v1.8.4/iojs-v1.8.4-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/io.js -xvf iojs-v1.8.4-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://iojs.org/dist/v2.5.0/iojs-v2.5.0-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/io.js -xvf iojs-v2.5.0-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://iojs.org/dist/v3.3.1/iojs-v3.3.1-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/io.js -xvf iojs-v3.3.1-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://nodejs.org/dist/v4.4.3/node-v4.4.3-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/node -xvf node-v4.4.3-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://nodejs.org/dist/v5.11.0/node-v5.11.0-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/node -xvf node-v5.11.0-linux-x86.tar.gz && \
source ~/.nvm/nvm.sh && \
wget --no-check-certificate https://nodejs.org/dist/v6.0.0/node-v6.0.0-linux-x86.tar.gz && \
tar -C ~/.nvm/versions/node -xvf node-v6.0.0-linux-x86.tar.gz
### get node-sass ###
RUN git clone https://github.com/sass/node-sass --recursive
WORKDIR /node-sass
### build the binaries ###
RUN echo "v3.7.0"
RUN rm -rf vendor
RUN git fetch
RUN git checkout v3.7.0
RUN git submodule update --init --recursive
RUN source ~/.nvm/nvm.sh && nvm use v0 && npm install --verbose && \
source ~/.nvm/nvm.sh && nvm use v0 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use v0.10 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use iojs-v1 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use iojs-v2 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use iojs-v3 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use iojs-v1.0 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use 4 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use 5 && node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && nvm use 6 && node scripts/build.js -f --verbose
RUN source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/node/node-v0.10.44-linux-x86/bin/{npm,node} /bin && \
npm install --verbose && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/node/node-v0.12.13-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/io.js/iojs-v1.0.4-linux-ia32/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/io.js/iojs-v1.8.4-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/io.js/iojs-v2.5.0-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/io.js/iojs-v3.3.1-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/node/node-v4.4.3-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/node/node-v5.11.0-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose && \
source ~/.nvm/nvm.sh && \
ln -sf ~/.nvm/versions/node/node-v6.0.0-linux-x86/bin/{npm,node} /bin && \
node scripts/build.js -f --verbose
RUN ls -lsa vendor
RUN tar -cvzf binaries.tar.gz vendor/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment