forked from openstf/stf
-
Notifications
You must be signed in to change notification settings - Fork 498
/
Dockerfile-debian-armhf
79 lines (71 loc) · 3.03 KB
/
Dockerfile-debian-armhf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# Copyright © 2020-2024 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
#
FROM arm32v7/debian:bookworm-slim
LABEL Maintainer="Denis Barbaron <[email protected]>"
LABEL Name="STF"
LABEL Url="https://github.com/devicefarmer/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 requirements
RUN export DEBIAN_FRONTEND=noninteractive && \
echo '--- Updating repositories' && \
apt-get update && \
echo '--- Upgrading repositories' && \
apt-get -y dist-upgrade && \
echo '--- Building node' && \
apt-get -y install pkg-config curl zip unzip wget python3 build-essential cmake ninja-build && \
cd /tmp && \
wget --progress=dot:mega \
https://nodejs.org/dist/v22.11.0/node-v22.11.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 libatomic1 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 && \
export VCPKG_FORCE_SYSTEM_BINARIES="arm" && \
echo 'npm install --save-dev pnpm' | su stf -s /bin/bash && \
echo 'npm install --python="/usr/bin/python3" --omit=optional --loglevel http' | su stf -s /bin/bash && \
echo '--- Assembling app' && \
echo 'npm pack' | su stf -s /bin/bash && \
tar xzf devicefarmer-stf-*.tgz --strip-components 1 -C /app && \
echo '/tmp/build/node_modules/.bin/bower cache clean' | su stf -s /bin/bash && \
echo 'npm prune --omit=dev' | su stf -s /bin/bash && \
wget --progress=dot:mega \
https://github.com/google/bundletool/releases/download/1.2.0/bundletool-all-1.2.0.jar && \
mkdir -p /app/bundletool && \
mv bundletool-all-1.2.0.jar /app/bundletool/bundletool.jar && \
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 pkg-config curl zip unzip wget python3 build-essential cmake ninja-build && \
apt-get -y clean && \
apt-get -y autoremove && \
cd /home/stf && \
rm -rf vcpkg .npm .cache .cmake-ts .config .local && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/* && \
cd /app && \
rm -rf doc .github .tx .semaphore *.md *.yaml LICENSE Dockerfile* \
.eslintrc .nvmrc .tool-versions res/.eslintrc && \
rm -rf /tmp/*
# Switch to the app user.
USER stf
# Show help by default.
CMD ["stf", "--help"]