diff --git a/docker/armv7hf/Dockerfile b/docker/armv7hf/Dockerfile deleted file mode 100644 index 996da601..00000000 --- a/docker/armv7hf/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM openstf/armv7hf-base:v1.0.1 - -# Add a user for the app. -RUN useradd --system \ - --no-create-home \ - --shell /usr/sbin/nologin \ - --home-dir /app \ - stf - -# Sneak the stf executable into $PATH. -ENV PATH /app/bin:$PATH - -# Work in app dir by default. -WORKDIR /app - -# Export default app port, not enough for all processes but it should do -# for now. -EXPOSE 3000 - -# Copy app source. -COPY . /app/ - -# Get the rest of the dependencies and build. -RUN export PATH=/app/node_modules/.bin:$PATH && \ - npm install && \ - bower install --allow-root && \ - gulp build && \ - npm prune --production - -# Switch to weak user. -USER stf - -# Show help by default. -CMD stf --help diff --git a/docker/armv7l/Dockerfile b/docker/armv7l/Dockerfile new file mode 100644 index 00000000..80b89cca --- /dev/null +++ b/docker/armv7l/Dockerfile @@ -0,0 +1,54 @@ +# Get the base image by running the included `base.sh` script. +FROM archlinuxarm/odroid-xu3:latest + +# Copy app source. +COPY . /tmp/build/ + +# Sneak the stf and node executables into $PATH. +ENV PATH /app/bin:/opt/node/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 && \ + 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 && \ + mv node_modules /app && \ + chown -R root:root /app && \ + runuser -u stf -- npm cache clean && \ + rm -rf /home/stf/.node-gyp && \ + cd /app && \ + rm -rf /tmp/* && \ + pacman --noconfirm -Rs git yasm python2 pkg-config make gcc && \ + pacman --noconfirm -Sc + +# Work in app dir by default. +WORKDIR /app + +# Export default app port, not enough for all processes but it should do +# for now. +EXPOSE 3000 + +# Switch to weak user. +USER stf + +# Show help by default. +CMD stf --help diff --git a/docker/armv7l/base.sh b/docker/armv7l/base.sh new file mode 100755 index 00000000..9dada7da --- /dev/null +++ b/docker/armv7l/base.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +wget http://archlinuxarm.org/os/ArchLinuxARM-odroid-xu3-latest.tar.gz | gunzip | docker import - archlinuxarm/odroid-xu3:latest