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 01:47:48 -07:00
|
|
|
&& rm -rf /var/lib/apt/lists/
|
2016-06-03 17:21:46 +00:00
|
|
|
|
2017-06-06 17:07:14 -07:00
|
|
|
RUN mkdir -p rootfs-overlay && \
|
|
|
|
ln -s /lib rootfs-overlay/lib64
|
2016-06-03 17:21:46 +00:00
|
|
|
|
|
|
|
COPY package.json /usr/src/app/
|
|
|
|
|
2017-06-30 21:07:02 -07:00
|
|
|
# Install only the production modules that have C extensions
|
2016-10-10 19:29:56 +00:00
|
|
|
RUN JOBS=MAX npm install --production --no-optional --unsafe-perm \
|
|
|
|
&& npm dedupe
|
2016-06-03 17:21:46 +00:00
|
|
|
|
2017-06-30 21:07:02 -07:00
|
|
|
COPY webpack.config.js remove-hashbang-loader.js /usr/src/app/
|
2016-06-03 17:21:46 +00:00
|
|
|
COPY src /usr/src/app/src
|
|
|
|
|
2016-10-10 19:29:56 +00:00
|
|
|
# Install devDependencies, build the coffeescript and then prune the deps
|
2017-06-30 21:07:02 -07:00
|
|
|
RUN cp -R node_modules node_modules_prod \
|
|
|
|
&& npm install --no-optional --unsafe-perm \
|
2016-10-10 19:29:56 +00:00
|
|
|
&& npm run lint \
|
|
|
|
&& npm run build \
|
2017-06-30 21:07:02 -07:00
|
|
|
&& rm -rf node_modules \
|
|
|
|
&& mv node_modules_prod node_modules
|
2016-06-03 17:21:46 +00:00
|
|
|
|
2016-07-06 22:10:47 -07: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
|
|
|
|
|
2017-06-30 21:07:02 -07:00
|
|
|
CMD rsync -a --delete node_modules dist rootfs-overlay /build
|
2016-06-03 17:21:46 +00:00
|
|
|
|
|
|
|
# -*- mode: dockerfile -*-
|
|
|
|
# vi: set ft=dockerfile :
|