1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00
OpenSTF/Dockerfile
Simo Kinnunen 944ab832f3 Get rid of our docker base image, docker has been doing digests for a
long time now so there's no need to attempt to outsmart the cache
now. It also makes the Dockerfile easier to modify since it's all there.
Updated to ubuntu 16.04 and node v6.3.0.
2016-07-21 19:39:21 +09:00

68 lines
2.1 KiB
Docker

FROM ubuntu:16.04
# 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
# Install app requirements. Trying to optimize push speed for dependant apps
# by reducing layers as much as possible. Note that one of the final steps
# installs development files for node-gyp so that npm install won't have to
# wait for them on the first native module installation.
RUN export DEBIAN_FRONTEND=noninteractive && \
useradd --system \
--create-home \
--shell /usr/sbin/nologin \
stf-build && \
useradd --system \
--create-home \
--shell /usr/sbin/nologin \
stf && \
sed -i'' 's@http://archive.ubuntu.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@' /etc/apt/sources.list && \
apt-get update && \
apt-get -y install wget python build-essential && \
cd /tmp && \
wget --progress=dot:mega \
https://nodejs.org/dist/v6.3.0/node-v6.3.0-linux-x64.tar.xz && \
tar -xJf node-v*.tar.xz --strip-components 1 -C /usr/local && \
rm node-v*.tar.xz && \
su stf-build -s /bin/bash -c '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js install' && \
apt-get -y install libzmq3-dev libprotobuf-dev git graphicsmagick yasm && \
apt-get clean && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/*
# Copy app source.
COPY . /tmp/build/
# Give permissions to our build user.
RUN mkdir -p /app && \
chown -R stf-build:stf-build /tmp/build /app
# Switch over to the build user.
USER stf-build
# Run the build.
RUN set -x && \
cd /tmp/build && \
export PATH=$PWD/node_modules/.bin:$PATH && \
npm install --loglevel http && \
npm pack && \
tar xzf stf-*.tgz --strip-components 1 -C /app && \
bower cache clean && \
npm prune --production && \
mv node_modules /app && \
npm cache clean && \
rm -rf ~/.node-gyp && \
cd /app && \
rm -rf /tmp/*
# Switch to the app user.
USER stf
# Show help by default.
CMD stf --help