1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +02:00

add alternative dockerfiles for armhf and x86_64 architectures based on debian

This commit is contained in:
Denis barbaron 2020-02-13 10:22:13 +01:00
parent fdc4846f9b
commit 457e08a9eb
2 changed files with 137 additions and 0 deletions

69
Dockerfile-debian-armhf Normal file
View file

@ -0,0 +1,69 @@
#
# Copyright © 2020 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
#
FROM arm32v7/debian:stretch-slim
LABEL Maintainer="Denis Barbaron <denis.barbaron@orange.com>"
LABEL Name="STF"
LABEL Url="https://github.com/openstf/stf/"
LABEL Description="STF docker image for armhf architecture"
# Sneak the stf executable into $PATH.
ENV PATH /app/bin:$PATH
# Work in app dir by default.
WORKDIR /app
# Copy app source.
COPY . /tmp/build/
# Install app requirement
RUN export DEBIAN_FRONTEND=noninteractive && \
echo '--- Updating repositories' && \
apt-get update && \
echo '--- Building node' && \
apt-get -y install wget python build-essential && \
cd /tmp && \
wget --progress=dot:mega \
https://nodejs.org/dist/v9.9.0/node-v9.9.0-linux-armv7l.tar.xz && \
tar -xJf node-v*.tar.xz --strip-components 1 -C /usr/local && \
rm node-v*.tar.xz && \
useradd --system \
--create-home \
--shell /usr/sbin/nologin \
stf && \
su stf -s /bin/bash -c '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js install' && \
apt-get -y install --no-install-recommends libzmq3-dev libprotobuf-dev git graphicsmagick yasm && \
echo '--- Building app' && \
mkdir -p /app && \
chown -R stf:stf /tmp/build && \
set -x && \
cd /tmp/build && \
export PATH=$PWD/node_modules/.bin:$PATH && \
sed -i'' -e '/phantomjs/d' package.json && \
npm install -g npm && \
echo 'npm cache clean --force' | su stf -s /bin/bash && \
echo 'npm install --no-optional --loglevel http' | su stf -s /bin/bash && \
echo '--- Assembling app' && \
echo 'npm pack' | su stf -s /bin/bash && \
tar xzf stf-*.tgz --strip-components 1 -C /app && \
echo '/tmp/build/node_modules/.bin/bower cache clean' | su stf -s /bin/bash && \
echo 'npm prune --production' | su stf -s /bin/bash && \
mv node_modules /app && \
chown -R root:root /app && \
echo '--- Cleaning up' && \
echo 'npm cache clean --force' | su stf -s /bin/bash && \
rm -rf ~/.node-gyp && \
apt-get -y purge wget python build-essential && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/* && \
cd /app && \
rm -rf /tmp/*
# Switch to the app user.
USER stf
# Show help by default.
CMD stf --help

68
Dockerfile-debian-x86_64 Normal file
View file

@ -0,0 +1,68 @@
#
# Copyright © 2020 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
#
FROM debian:stretch-slim
LABEL Maintainer="Denis Barbaron <denis.barbaron@orange.com>"
LABEL Name="STF"
LABEL Url="https://github.com/openstf/stf/"
LABEL Description="STF docker image for x86_64 architecture"
# Sneak the stf executable into $PATH.
ENV PATH /app/bin:$PATH
# Work in app dir by default.
WORKDIR /app
# Copy app source.
COPY . /tmp/build/
# Install app requirements
RUN export DEBIAN_FRONTEND=noninteractive && \
echo '--- Updating repositories' && \
apt-get update && \
echo '--- Building node' && \
apt-get -y install wget python build-essential && \
cd /tmp && \
wget --progress=dot:mega \
https://nodejs.org/dist/v8.9.3/node-v8.9.3-linux-x64.tar.xz && \
tar -xJf node-v*.tar.xz --strip-components 1 -C /usr/local && \
rm node-v*.tar.xz && \
useradd --system \
--create-home \
--shell /usr/sbin/nologin \
stf && \
su stf -s /bin/bash -c '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js install' && \
apt-get -y install --no-install-recommends libzmq3-dev libprotobuf-dev git graphicsmagick yasm && \
echo '--- Building app' && \
mkdir -p /app && \
chown -R stf:stf /tmp/build && \
set -x && \
cd /tmp/build && \
export PATH=$PWD/node_modules/.bin:$PATH && \
sed -i'' -e '/phantomjs/d' package.json && \
npm install -g npm && \
echo 'npm install --no-optional --loglevel http' | su stf -s /bin/bash && \
echo '--- Assembling app' && \
echo 'npm pack' | su stf -s /bin/bash && \
tar xzf stf-*.tgz --strip-components 1 -C /app && \
echo '/tmp/build/node_modules/.bin/bower cache clean' | su stf -s /bin/bash && \
echo 'npm prune --production' | su stf -s /bin/bash && \
mv node_modules /app && \
chown -R root:root /app && \
echo '--- Cleaning up' && \
echo 'npm cache clean --force' | su stf -s /bin/bash && \
rm -rf ~/.node-gyp && \
apt-get -y purge wget python build-essential && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/* && \
cd /app && \
rm -rf /tmp/*
# Switch to the app user.
USER stf
# Show help by default.
CMD stf --help