2016-06-03 17:21:46 +00:00
|
|
|
# Build nodejs dependencies
|
|
|
|
|
|
|
|
# The node version here should match the version of the runtime image which is
|
|
|
|
# specified in the base-image subdirectory in the project
|
|
|
|
FROM resin/%%ARCH%%-node:6.5-slim
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y \
|
|
|
|
g++ \
|
|
|
|
libsqlite3-dev \
|
|
|
|
make \
|
|
|
|
python \
|
|
|
|
rsync \
|
|
|
|
wget \
|
2016-07-06 08:47:48 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/
|
2016-06-03 17:21:46 +00:00
|
|
|
|
|
|
|
ENV DOCKER_COMPOSE_VERSION 1.7.1
|
|
|
|
|
|
|
|
ENV DOCKER_COMPOSE_SHA256_amd64 37df85ee18bf0e2a8d71cbfb8198b1c06cc388f19118be7bdfc4d6db112af834
|
|
|
|
ENV DOCKER_COMPOSE_SHA256_i386 b926fd9a2a9d89358f1353867706f94558a62caaf3aa72bf10bcbbe31e1a44f0
|
|
|
|
ENV DOCKER_COMPOSE_SHA256_rpi 3f0b8c69c66a2daa5fbb0c127cb76ca95d7125827a9c43dd3c36f9bc2ed6e0e5
|
|
|
|
ENV DOCKER_COMPOSE_SHA256_armv7hf 3f0b8c69c66a2daa5fbb0c127cb76ca95d7125827a9c43dd3c36f9bc2ed6e0e5
|
|
|
|
ENV DOCKER_COMPOSE_SHA256_armel a1025fed97536e2698798ea277a014ec5e1eae816a8cf3155ecbe9679e3e7bac
|
|
|
|
|
|
|
|
RUN set -x \
|
|
|
|
&& mkdir -p rootfs-overlay/usr/bin/ \
|
|
|
|
&& ln -s /lib rootfs-overlay/lib64 \
|
|
|
|
&& pkgname='docker-compose' \
|
|
|
|
&& arch=%%ARCH%% \
|
|
|
|
&& if [ $arch = 'rpi' -o $arch = 'armv7hf' ]; then arch=armhf; fi \
|
|
|
|
&& base="http://resin-packages.s3.amazonaws.com/${pkgname}" \
|
|
|
|
&& pkgver=$DOCKER_COMPOSE_VERSION \
|
|
|
|
&& checksum=$DOCKER_COMPOSE_SHA256_%%ARCH%% \
|
|
|
|
&& wget "${base}/${pkgver}/${pkgname}-linux-${arch}-${pkgver}.tar.gz" \
|
|
|
|
&& echo "$checksum ${pkgname}-linux-${arch}-${pkgver}.tar.gz" | sha256sum -c \
|
|
|
|
&& tar xzf "${pkgname}-linux-${arch}-${pkgver}.tar.gz" --strip-components=1 -C rootfs-overlay/usr/bin \
|
|
|
|
&& mv "rootfs-overlay/usr/bin/${pkgname}-linux-${arch}" rootfs-overlay/usr/bin/docker-compose
|
|
|
|
|
|
|
|
COPY package.json /usr/src/app/
|
|
|
|
|
2016-07-06 08:47:48 +00:00
|
|
|
# First install devDependencies too in order to run the build
|
|
|
|
RUN JOBS=MAX npm install --unsafe-perm
|
2016-06-03 17:21:46 +00:00
|
|
|
|
|
|
|
COPY src /usr/src/app/src
|
|
|
|
|
2016-09-09 08:44:32 +00:00
|
|
|
RUN npm run lint \
|
|
|
|
&& npm run build
|
2016-07-06 08:47:48 +00:00
|
|
|
|
|
|
|
# Re-install just production modules. This should be fast due to npm cache from previous layer
|
|
|
|
RUN rm -rf node_modules \
|
|
|
|
&& JOBS=MAX npm install --unsafe-perm --production --no-optional \
|
|
|
|
&& npm dedupe
|
2016-06-03 17:21:46 +00:00
|
|
|
|
2016-07-07 05:10:47 +00:00
|
|
|
# Remove various uneeded filetypes in order to reduce space
|
|
|
|
RUN find . -path '*/coverage/*' -o -path '*/test/*' -o -path '*/.nyc_output/*' \
|
|
|
|
-o -name '*.tar.*' -o -name '*.in' -o -name '*.cc' \
|
|
|
|
-o -name '*.c' -o -name '*.coffee' -o -name '*.eslintrc' \
|
|
|
|
-o -name '*.h' -o -name '*.html' -o -name '*.markdown' \
|
|
|
|
-o -name '*.md' -o -name '*.patch' -o -name '*.png' \
|
|
|
|
-o -name '*.yml' \
|
|
|
|
-delete \
|
|
|
|
&& find . -type f -path '*/node_modules/sqlite3/deps*' -delete \
|
|
|
|
&& find . -type f -path '*/node_modules/knex/build*' -delete
|
2016-06-03 17:21:46 +00:00
|
|
|
|
|
|
|
# Create /var/run/resin for the gosuper to place its socket in
|
|
|
|
RUN mkdir -p rootfs-overlay/var/run/resin
|
|
|
|
|
|
|
|
COPY entry.sh run.sh package.json rootfs-overlay/usr/src/app/
|
|
|
|
|
|
|
|
COPY inittab rootfs-overlay/etc/inittab
|
|
|
|
|
|
|
|
CMD rsync -a --delete node_modules src rootfs-overlay /build
|
|
|
|
|
|
|
|
# -*- mode: dockerfile -*-
|
|
|
|
# vi: set ft=dockerfile :
|