Smaller armv7l image. Setting up an automated nightly build for it.

This commit is contained in:
Simo Kinnunen
2016-02-24 05:52:06 +09:00
parent a6e783ed1d
commit 1cfe3d8758
4 changed files with 132 additions and 29 deletions

View File

@@ -1,44 +1,55 @@
# Get the base image by running the included `base.sh` script.
FROM archlinuxarm/odroid-xu3:latest
# Get the base image by running the included `mkimage-alpine.sh` script, or
# get a fresh copy from github.com/docker/docker/contrib/.
FROM alpine:edge
# Copy app source.
COPY . /tmp/build/
# Sneak the stf and node executables into $PATH.
ENV PATH /app/bin:/opt/node/bin:$PATH
# Sneak the stf executable into $PATH.
ENV PATH /app/bin:$PATH
# Build the whole thing. Since Docker Hub doesn't really support other archs,
# we'll run a full daily build by ourselves, so it doesn't necessary have to
# be separated into multiple steps for speed.
RUN set -x && \
useradd --system --create-home stf && \
echo 'Server = http://mirror.archlinuxarm.org/$arch/$repo' > /etc/pacman.d/mirrorlist && \
pacman -Sy && \
pacman --noconfirm -S zeromq protobuf git graphicsmagick yasm python2 pkg-config make gcc && \
curl -o /opt/node.tar.xz https://nodejs.org/dist/v5.3.0/node-v5.3.0-linux-armv7l.tar.xz && \
cd /opt && \
tar xf node.tar.xz && \
rm node.tar.xz && \
mv node-* node && \
#
# Node build taken from https://github.com/mhart/alpine-node and slightly adapted.
RUN set -xo pipefail && \
echo '--- Updating repositories' && \
echo '@testing http://nl.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \
apk update && \
echo '--- Building node' && \
apk add curl make gcc g++ binutils-gold python linux-headers paxctl libgcc libstdc++ && \
curl -sSL https://nodejs.org/dist/v5.7.0/node-v5.7.0.tar.gz | tar -xz && \
cd /node-v* && \
./configure --prefix=/usr && \
make -j$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
make install && \
paxctl -cm /usr/bin/node && \
echo '--- Building app' && \
addgroup -S stf && \
adduser -S -G stf stf && \
chown -R stf:stf /tmp/build && \
cd /tmp/build && \
export PATH=$PWD/node_modules/.bin:$PATH && \
sed -i'' -e '/phantomjs/d' package.json && \
export JOBS=$(nproc) && \
runuser -u stf -- npm install --no-optional && \
runuser -u stf -- npm pack && \
mkdir -p /app && \
tar xf stf-*.tgz --strip-components 1 -C /app && \
runuser -u stf -- bower cache clean && \
runuser -u stf -- npm prune --production && \
apk add git zeromq-dev protobuf-dev graphicsmagick@testing && \
export JOBS=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
echo 'npm install --no-optional' | su stf -s /bin/sh && \
echo '--- Assembling app' && \
echo 'npm pack' | su stf -s /bin/sh && \
tar -xzf stf-*.tgz && \
mv package /app && \
echo 'bower cache clean' | su stf -s /bin/sh && \
echo 'npm prune --production' | su stf -s /bin/sh && \
mv node_modules /app && \
chown -R root:root /app && \
runuser -u stf -- npm cache clean && \
echo '--- Cleaning up' && \
echo 'npm cache clean' | su stf -s /bin/sh && \
rm -rf /home/stf/.node-gyp && \
cd /app && \
rm -rf /tmp/* && \
pacman --noconfirm -Rs git yasm python2 pkg-config make gcc && \
pacman --noconfirm -Sc
apk del curl make gcc g++ binutils-gold python linux-headers paxctl && \
rm -rf /node-v* \
/usr/share/man /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp \
/usr/lib/node_modules/npm/man /usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html
# Work in app dir by default.
WORKDIR /app