mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-11 08:46:16 +00:00
ci: add scheduled builds
This commit is contained in:
119
images/app-builder/Dockerfile
Normal file
119
images/app-builder/Dockerfile
Normal file
@@ -0,0 +1,119 @@
|
||||
### Set base image
|
||||
FROM ubuntu:20.04
|
||||
|
||||
LABEL version="2.0.0" \
|
||||
description="Build environment for the StApps app." \
|
||||
maintainer="Jovan Krunić <krunic@uni-frankfurt.de>"
|
||||
|
||||
### Configure versions to install
|
||||
ENV ANDROID_APIS="android-30" \
|
||||
ANDROID_BUILD_TOOLS_VERSION="30.0.2" \
|
||||
NPM_VERSION="^9.0.0" \
|
||||
IONIC_VERSION="^6.0.0" \
|
||||
CORDOVA_RES_VERSION="latest" \
|
||||
### Configure download URLs
|
||||
ANDROID_SDK_TOOLS_DOWNLOAD_URL="https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip" \
|
||||
GOOGLE_SIGNING_KEY_URL="https://dl-ssl.google.com/linux/linux_signing_key.pub" \
|
||||
GOOGLE_CHROME_REPOSITORY_URL="http://dl.google.com/linux/chrome/deb/" \
|
||||
### Android SDK path
|
||||
ANDROID_SDK_ROOT="/opt/android-sdk" \
|
||||
### Installation files
|
||||
SCRIPTS_DIRECTORY="scripts" \
|
||||
NODE_SETUP_SCRIPT="node_setup.sh" \
|
||||
TMP_PROJECT_NAME="tmp-project"
|
||||
|
||||
### Set $PATH
|
||||
#ENV PATH=$ANDROID_SDK_ROOT/cmdline-tools/:$ANDROID_SDK_ROOT/cmdline-tools/bin:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH
|
||||
ENV PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH
|
||||
|
||||
### Replace shell with bash
|
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh && \
|
||||
### Set debconf to run non-interactively
|
||||
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
|
||||
### Install locales and base dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
locales \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
libssl-dev \
|
||||
git \
|
||||
gradle \
|
||||
ca-certificates-java \
|
||||
python \
|
||||
python3-pip \
|
||||
software-properties-common \
|
||||
ssh \
|
||||
unzip \
|
||||
wget \
|
||||
gpg-agent \
|
||||
jq \
|
||||
musl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
### Install Java Development Kit 17
|
||||
RUN add-apt-repository -y ppa:openjdk-r/ppa && apt-get update && \
|
||||
apt-get install --no-install-recommends -y openjdk-17-jdk \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
### Setup the locale
|
||||
RUN sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||
locale-gen en_US.UTF-8
|
||||
ENV LANG=en_US.UTF-8 \
|
||||
LANGUAGE=en_US \
|
||||
LC_ALL=en_US.UTF-8
|
||||
RUN dpkg-reconfigure --frontend noninteractive locales
|
||||
|
||||
### add chrome repository
|
||||
RUN wget -q -O - $GOOGLE_SIGNING_KEY_URL | apt-key add -
|
||||
RUN echo "deb $GOOGLE_CHROME_REPOSITORY_URL stable main" >> /etc/apt/sources.list.d/google.list
|
||||
|
||||
### Install Chrome
|
||||
RUN apt-get update -y && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
### Install chrome and virtual frame buffer
|
||||
google-chrome-stable xvfb && \
|
||||
### Clear apt cache
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
### Workaround to fix cacerts problem (Ubuntu):
|
||||
### https://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty
|
||||
RUN rm /etc/ssl/certs/java/cacerts && \
|
||||
update-ca-certificates -f
|
||||
|
||||
### Install android
|
||||
RUN curl $ANDROID_SDK_TOOLS_DOWNLOAD_URL > /tmp/android-sdk.zip && \
|
||||
unzip /tmp/android-sdk.zip && \
|
||||
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools && \
|
||||
mv cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/tools && \
|
||||
### Add licences (for "auto-accept licenses")
|
||||
yes | sdkmanager --licenses && \
|
||||
### Install platform tools
|
||||
sdkmanager "platforms;$ANDROID_APIS" "build-tools;$ANDROID_BUILD_TOOLS_VERSION"
|
||||
|
||||
### Copy scripts directory into the tmp folder, so it's available to the following commands
|
||||
COPY $SCRIPTS_DIRECTORY/$NODE_SETUP_SCRIPT /tmp/
|
||||
|
||||
RUN bash /tmp/$NODE_SETUP_SCRIPT && apt-get install -y nodejs && \
|
||||
### Install wanted npm version
|
||||
npm install -g --unsafe-perm npm@$NPM_VERSION && \
|
||||
### Install needed global npm packages
|
||||
npm install -g --unsafe-perm @ionic/cli@$IONIC_VERSION cordova-res@$CORDOVA_RES_VERSION
|
||||
|
||||
RUN cd / && ionic start $TMP_PROJECT_NAME blank --type=angular --capacitor --no-git --no-interactive && \
|
||||
cd $TMP_PROJECT_NAME && ionic capacitor add android && export NG_CLI_ANALYTICS=ci && ionic capacitor build android --no-open && \
|
||||
cd android && ./gradlew assembleDebug && \
|
||||
cd / && rm -rf $TMP_PROJECT_NAME
|
||||
|
||||
|
||||
### Compatibility with musl libc
|
||||
RUN ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
|
||||
|
||||
### Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
CMD [""]
|
||||
20
images/app-builder/package.json
Normal file
20
images/app-builder/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@openstapps/app-builder-image",
|
||||
"version": "3.0.0-next.3",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"contributors": [
|
||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||
"Michel Jonathan Schmitz",
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"files": [
|
||||
"Dockerfile",
|
||||
"README.md",
|
||||
"CHANGELOG.md"
|
||||
]
|
||||
}
|
||||
372
images/app-builder/scripts/node_setup.sh
Normal file
372
images/app-builder/scripts/node_setup.sh
Normal file
@@ -0,0 +1,372 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Discussion, issues and change requests at:
|
||||
# https://github.com/nodesource/distributions
|
||||
#
|
||||
# Script to install the NodeSource Node.js 18.x repo onto a
|
||||
# Debian or Ubuntu system.
|
||||
#
|
||||
# Run as root or insert `sudo -E` before `bash`:
|
||||
#
|
||||
# curl -sL https://deb.nodesource.com/setup_18.x | bash -
|
||||
# or
|
||||
# wget -qO- https://deb.nodesource.com/setup_18.x | bash -
|
||||
#
|
||||
# CONTRIBUTIONS TO THIS SCRIPT
|
||||
#
|
||||
# This script is built from a template in
|
||||
# https://github.com/nodesource/distributions/tree/master/deb/src
|
||||
# please don't submit pull requests against the built scripts.
|
||||
#
|
||||
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
SCRSUFFIX="_18.x"
|
||||
NODENAME="Node.js 18.x"
|
||||
NODEREPO="node_18.x"
|
||||
NODEPKG="nodejs"
|
||||
|
||||
print_status() {
|
||||
echo
|
||||
echo "## $1"
|
||||
echo
|
||||
}
|
||||
|
||||
if test -t 1; then # if terminal
|
||||
ncolors=$(which tput > /dev/null && tput colors) # supports color
|
||||
if test -n "$ncolors" && test $ncolors -ge 8; then
|
||||
termcols=$(tput cols)
|
||||
bold="$(tput bold)"
|
||||
underline="$(tput smul)"
|
||||
standout="$(tput smso)"
|
||||
normal="$(tput sgr0)"
|
||||
black="$(tput setaf 0)"
|
||||
red="$(tput setaf 1)"
|
||||
green="$(tput setaf 2)"
|
||||
yellow="$(tput setaf 3)"
|
||||
blue="$(tput setaf 4)"
|
||||
magenta="$(tput setaf 5)"
|
||||
cyan="$(tput setaf 6)"
|
||||
white="$(tput setaf 7)"
|
||||
fi
|
||||
fi
|
||||
|
||||
print_bold() {
|
||||
title="$1"
|
||||
text="$2"
|
||||
|
||||
echo
|
||||
echo "${red}================================================================================${normal}"
|
||||
echo "${red}================================================================================${normal}"
|
||||
echo
|
||||
echo -e " ${bold}${yellow}${title}${normal}"
|
||||
echo
|
||||
echo -en " ${text}"
|
||||
echo
|
||||
echo "${red}================================================================================${normal}"
|
||||
echo "${red}================================================================================${normal}"
|
||||
}
|
||||
|
||||
bail() {
|
||||
echo 'Error executing command, exiting'
|
||||
exit 1
|
||||
}
|
||||
|
||||
exec_cmd_nobail() {
|
||||
echo "+ $1"
|
||||
bash -c "$1"
|
||||
}
|
||||
|
||||
exec_cmd() {
|
||||
exec_cmd_nobail "$1" || bail
|
||||
}
|
||||
|
||||
node_deprecation_warning() {
|
||||
if [[ "X${NODENAME}" == "Xio.js 1.x" ||
|
||||
"X${NODENAME}" == "Xio.js 2.x" ||
|
||||
"X${NODENAME}" == "Xio.js 3.x" ||
|
||||
"X${NODENAME}" == "XNode.js 0.10" ||
|
||||
"X${NODENAME}" == "XNode.js 0.12" ||
|
||||
"X${NODENAME}" == "XNode.js 4.x LTS Argon" ||
|
||||
"X${NODENAME}" == "XNode.js 5.x" ||
|
||||
"X${NODENAME}" == "XNode.js 6.x LTS Boron" ||
|
||||
"X${NODENAME}" == "XNode.js 7.x" ||
|
||||
"X${NODENAME}" == "XNode.js 8.x LTS Carbon" ||
|
||||
"X${NODENAME}" == "XNode.js 9.x" ||
|
||||
"X${NODENAME}" == "XNode.js 10.x" ||
|
||||
"X${NODENAME}" == "XNode.js 11.x" ||
|
||||
"X${NODENAME}" == "XNode.js 12.x" ||
|
||||
"X${NODENAME}" == "XNode.js 13.x" ||
|
||||
"X${NODENAME}" == "XNode.js 14.x" ||
|
||||
"X${NODENAME}" == "XNode.js 15.x" ||
|
||||
"X${NODENAME}" == "XNode.js 17.x" ]]; then
|
||||
|
||||
print_bold \
|
||||
" DEPRECATION WARNING " "\
|
||||
${bold}${NODENAME} is no longer actively supported!${normal}
|
||||
|
||||
${bold}You will not receive security or critical stability updates${normal} for this version.
|
||||
|
||||
You should migrate to a supported version of Node.js as soon as possible.
|
||||
Use the installation script that corresponds to the version of Node.js you
|
||||
wish to install. e.g.
|
||||
|
||||
* ${green}https://deb.nodesource.com/setup_16.x — Node.js 16 \"Gallium\"${normal}
|
||||
* ${green}https://deb.nodesource.com/setup_18.x — Node.js 18 LTS \"Hydrogen\"${normal} (recommended)
|
||||
* ${green}https://deb.nodesource.com/setup_19.x — Node.js 19 \"Nineteen\"${normal}
|
||||
* ${green}https://deb.nodesource.com/setup_20.x — Node.js 20 \"Iron\"${normal} (current)
|
||||
|
||||
Please see ${bold}https://github.com/nodejs/Release${normal} for details about which
|
||||
version may be appropriate for you.
|
||||
|
||||
The ${bold}NodeSource${normal} Node.js distributions repository contains
|
||||
information both about supported versions of Node.js and supported Linux
|
||||
distributions. To learn more about usage, see the repository:
|
||||
${bold}https://github.com/nodesource/distributions${normal}
|
||||
"
|
||||
echo
|
||||
echo "Continuing in 20 seconds ..."
|
||||
echo
|
||||
sleep 20
|
||||
fi
|
||||
}
|
||||
|
||||
script_deprecation_warning() {
|
||||
if [ "X${SCRSUFFIX}" == "X" ]; then
|
||||
print_bold \
|
||||
" SCRIPT DEPRECATION WARNING " "\
|
||||
This script, located at ${bold}https://deb.nodesource.com/setup${normal}, used to
|
||||
install Node.js 0.10, is deprecated and will eventually be made inactive.
|
||||
|
||||
You should use the script that corresponds to the version of Node.js you
|
||||
wish to install. e.g.
|
||||
|
||||
* ${green}https://deb.nodesource.com/setup_16.x — Node.js 16 \"Gallium\"${normal}
|
||||
* ${green}https://deb.nodesource.com/setup_18.x — Node.js 18 LTS \"Hydrogen\"${normal} (recommended)
|
||||
* ${green}https://deb.nodesource.com/setup_19.x — Node.js 19 \"Nineteen\"${normal}
|
||||
* ${green}https://deb.nodesource.com/setup_20.x — Node.js 20 \"Iron\"${normal} (current)
|
||||
|
||||
Please see ${bold}https://github.com/nodejs/Release${normal} for details about which
|
||||
version may be appropriate for you.
|
||||
|
||||
The ${bold}NodeSource${normal} Node.js Linux distributions GitHub repository contains
|
||||
information about which versions of Node.js and which Linux distributions
|
||||
are supported and how to use the install scripts.
|
||||
${bold}https://github.com/nodesource/distributions${normal}
|
||||
"
|
||||
|
||||
echo
|
||||
echo "Continuing in 20 seconds (press Ctrl-C to abort) ..."
|
||||
echo
|
||||
sleep 20
|
||||
fi
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
||||
script_deprecation_warning
|
||||
node_deprecation_warning
|
||||
|
||||
print_status "Installing the NodeSource ${NODENAME} repo..."
|
||||
|
||||
if $(uname -m | grep -Eq ^armv6); then
|
||||
print_status "You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the 'linux-armv6l' binary tarballs available directly from nodejs.org for Node.js 4 and later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PRE_INSTALL_PKGS=""
|
||||
|
||||
# Check that HTTPS transport is available to APT
|
||||
# (Check snaked from: https://get.docker.io/ubuntu/)
|
||||
|
||||
if [ ! -e /usr/lib/apt/methods/https ]; then
|
||||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} apt-transport-https"
|
||||
fi
|
||||
|
||||
if [ ! -x /usr/bin/lsb_release ]; then
|
||||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release"
|
||||
fi
|
||||
|
||||
if [ ! -x /usr/bin/curl ] && [ ! -x /usr/bin/wget ]; then
|
||||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} curl"
|
||||
fi
|
||||
|
||||
# Used by apt-key to add new keys
|
||||
|
||||
if [ ! -x /usr/bin/gpg ]; then
|
||||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} gnupg"
|
||||
fi
|
||||
|
||||
# Populating Cache
|
||||
print_status "Populating apt-get cache..."
|
||||
exec_cmd 'apt-get update'
|
||||
|
||||
if [ "X${PRE_INSTALL_PKGS}" != "X" ]; then
|
||||
print_status "Installing packages required for setup:${PRE_INSTALL_PKGS}..."
|
||||
# This next command needs to be redirected to /dev/null or the script will bork
|
||||
# in some environments
|
||||
exec_cmd "apt-get install -y${PRE_INSTALL_PKGS} > /dev/null 2>&1"
|
||||
fi
|
||||
|
||||
IS_PRERELEASE=$(lsb_release -d | grep 'Ubuntu .*development' >& /dev/null; echo $?)
|
||||
if [[ $IS_PRERELEASE -eq 0 ]]; then
|
||||
print_status "Your distribution, identified as \"$(lsb_release -d -s)\", is a pre-release version of Ubuntu. NodeSource does not maintain official support for Ubuntu versions until they are formally released. You can try using the manual installation instructions available at https://github.com/nodesource/distributions and use the latest supported Ubuntu version name as the distribution identifier, although this is not guaranteed to work."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISTRO=$(lsb_release -c -s)
|
||||
|
||||
check_alt() {
|
||||
if [ "X${DISTRO}" == "X${2}" ]; then
|
||||
echo
|
||||
echo "## You seem to be using ${1} version ${DISTRO}."
|
||||
echo "## This maps to ${3} \"${4}\"... Adjusting for you..."
|
||||
DISTRO="${4}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_alt "Astra Linux" "orel" "Debian" "stretch"
|
||||
check_alt "BOSS" "anokha" "Debian" "wheezy"
|
||||
check_alt "BOSS" "anoop" "Debian" "jessie"
|
||||
check_alt "BOSS" "drishti" "Debian" "stretch"
|
||||
check_alt "BOSS" "unnati" "Debian" "buster"
|
||||
check_alt "BOSS" "urja" "Debian" "bullseye"
|
||||
check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie"
|
||||
check_alt "bunsenlabs" "helium" "Debian" "stretch"
|
||||
check_alt "bunsenlabs" "lithium" "Debian" "buster"
|
||||
check_alt "Devuan" "jessie" "Debian" "jessie"
|
||||
check_alt "Devuan" "ascii" "Debian" "stretch"
|
||||
check_alt "Devuan" "beowulf" "Debian" "buster"
|
||||
check_alt "Devuan" "chimaera" "Debian" "bullseye"
|
||||
check_alt "Devuan" "ceres" "Debian" "sid"
|
||||
check_alt "Devuan" "daedalus" "Debian" "bookworm"
|
||||
check_alt "Deepin" "panda" "Debian" "sid"
|
||||
check_alt "Deepin" "unstable" "Debian" "sid"
|
||||
check_alt "Deepin" "stable" "Debian" "buster"
|
||||
check_alt "Deepin" "apricot" "Debian" "buster"
|
||||
check_alt "Deepin" "beige" "Debian" "bookworm"
|
||||
check_alt "elementaryOS" "luna" "Ubuntu" "precise"
|
||||
check_alt "elementaryOS" "freya" "Ubuntu" "trusty"
|
||||
check_alt "elementaryOS" "loki" "Ubuntu" "xenial"
|
||||
check_alt "elementaryOS" "juno" "Ubuntu" "bionic"
|
||||
check_alt "elementaryOS" "hera" "Ubuntu" "bionic"
|
||||
check_alt "elementaryOS" "odin" "Ubuntu" "focal"
|
||||
check_alt "elementaryOS" "jolnir" "Ubuntu" "focal"
|
||||
check_alt "elementaryOS" "horus" "Ubuntu" "jammy"
|
||||
check_alt "Kali" "sana" "Debian" "jessie"
|
||||
check_alt "Kali" "kali-rolling" "Debian" "bullseye"
|
||||
check_alt "Linux Mint" "maya" "Ubuntu" "precise"
|
||||
check_alt "Linux Mint" "qiana" "Ubuntu" "trusty"
|
||||
check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty"
|
||||
check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty"
|
||||
check_alt "Linux Mint" "rosa" "Ubuntu" "trusty"
|
||||
check_alt "Linux Mint" "sarah" "Ubuntu" "xenial"
|
||||
check_alt "Linux Mint" "serena" "Ubuntu" "xenial"
|
||||
check_alt "Linux Mint" "sonya" "Ubuntu" "xenial"
|
||||
check_alt "Linux Mint" "sylvia" "Ubuntu" "xenial"
|
||||
check_alt "Linux Mint" "tara" "Ubuntu" "bionic"
|
||||
check_alt "Linux Mint" "tessa" "Ubuntu" "bionic"
|
||||
check_alt "Linux Mint" "tina" "Ubuntu" "bionic"
|
||||
check_alt "Linux Mint" "tricia" "Ubuntu" "bionic"
|
||||
check_alt "Linux Mint" "ulyana" "Ubuntu" "focal"
|
||||
check_alt "Linux Mint" "ulyssa" "Ubuntu" "focal"
|
||||
check_alt "Linux Mint" "uma" "Ubuntu" "focal"
|
||||
check_alt "Linux Mint" "una" "Ubuntu" "focal"
|
||||
check_alt "Linux Mint" "vanessa" "Ubuntu" "jammy"
|
||||
check_alt "Linux Mint" "vera" "Ubuntu" "jammy"
|
||||
check_alt "Liquid Lemur" "lemur-3" "Debian" "stretch"
|
||||
check_alt "LMDE" "betsy" "Debian" "jessie"
|
||||
check_alt "LMDE" "cindy" "Debian" "stretch"
|
||||
check_alt "LMDE" "debbie" "Debian" "buster"
|
||||
check_alt "LMDE" "elsie" "Debian" "bullseye"
|
||||
check_alt "MX Linux 17" "Horizon" "Debian" "stretch"
|
||||
check_alt "MX Linux 18" "Continuum" "Debian" "stretch"
|
||||
check_alt "MX Linux 19" "patito feo" "Debian" "buster"
|
||||
check_alt "MX Linux 21" "wildflower" "Debian" "bullseye"
|
||||
check_alt "Pardus" "onyedi" "Debian" "stretch"
|
||||
check_alt "Parrot" "ara" "Debian" "bullseye"
|
||||
check_alt "PureOS" "green" "Debian" "sid"
|
||||
check_alt "PureOS" "amber" "Debian" "buster"
|
||||
check_alt "PureOS" "byzantium" "Debian" "bullseye"
|
||||
check_alt "SolydXK" "solydxk-9" "Debian" "stretch"
|
||||
check_alt "Sparky Linux" "Tyche" "Debian" "stretch"
|
||||
check_alt "Sparky Linux" "Nibiru" "Debian" "buster"
|
||||
check_alt "Sparky Linux" "Po-Tolo" "Debian" "bullseye"
|
||||
check_alt "Tanglu" "chromodoris" "Debian" "jessie"
|
||||
check_alt "Trisquel" "toutatis" "Ubuntu" "precise"
|
||||
check_alt "Trisquel" "belenos" "Ubuntu" "trusty"
|
||||
check_alt "Trisquel" "flidas" "Ubuntu" "xenial"
|
||||
check_alt "Trisquel" "etiona" "Ubuntu" "bionic"
|
||||
check_alt "Ubilinux" "dolcetto" "Debian" "stretch"
|
||||
check_alt "Uruk GNU/Linux" "lugalbanda" "Ubuntu" "xenial"
|
||||
|
||||
if [ "X${DISTRO}" == "Xdebian" ]; then
|
||||
print_status "Unknown Debian-based distribution, checking /etc/debian_version..."
|
||||
NEWDISTRO=$([ -e /etc/debian_version ] && cut -d/ -f1 < /etc/debian_version)
|
||||
if [ "X${NEWDISTRO}" == "X" ]; then
|
||||
print_status "Could not determine distribution from /etc/debian_version..."
|
||||
else
|
||||
DISTRO=$NEWDISTRO
|
||||
print_status "Found \"${DISTRO}\" in /etc/debian_version..."
|
||||
fi
|
||||
fi
|
||||
|
||||
print_status "Confirming \"${DISTRO}\" is supported..."
|
||||
|
||||
if [ -x /usr/bin/curl ]; then
|
||||
exec_cmd_nobail "curl -sLf -o /dev/null 'https://deb.nodesource.com/${NODEREPO}/dists/${DISTRO}/Release'"
|
||||
RC=$?
|
||||
else
|
||||
exec_cmd_nobail "wget -qO /dev/null -o /dev/null 'https://deb.nodesource.com/${NODEREPO}/dists/${DISTRO}/Release'"
|
||||
RC=$?
|
||||
fi
|
||||
|
||||
if [[ $RC != 0 ]]; then
|
||||
print_status "Your distribution, identified as \"${DISTRO}\", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "/etc/apt/sources.list.d/chris-lea-node_js-$DISTRO.list" ]; then
|
||||
print_status 'Removing Launchpad PPA Repository for NodeJS...'
|
||||
|
||||
exec_cmd_nobail 'add-apt-repository -y -r ppa:chris-lea/node.js'
|
||||
exec_cmd "rm -f /etc/apt/sources.list.d/chris-lea-node_js-${DISTRO}.list"
|
||||
fi
|
||||
|
||||
print_status 'Adding the NodeSource signing key to your keyring...'
|
||||
keyring='/usr/share/keyrings'
|
||||
node_key_url="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
|
||||
local_node_key="$keyring/nodesource.gpg"
|
||||
|
||||
if [ -x /usr/bin/curl ]; then
|
||||
exec_cmd "curl -s $node_key_url | gpg --dearmor | tee $local_node_key >/dev/null"
|
||||
else
|
||||
exec_cmd "wget -q -O - $node_key_url | gpg --dearmor | tee $local_node_key >/dev/null"
|
||||
fi
|
||||
|
||||
print_status "Creating apt sources list file for the NodeSource ${NODENAME} repo..."
|
||||
|
||||
exec_cmd "echo 'deb [signed-by=$local_node_key] https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' > /etc/apt/sources.list.d/nodesource.list"
|
||||
exec_cmd "echo 'deb-src [signed-by=$local_node_key] https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' >> /etc/apt/sources.list.d/nodesource.list"
|
||||
|
||||
print_status 'Running `apt-get update` for you...'
|
||||
|
||||
exec_cmd 'apt-get update'
|
||||
|
||||
yarn_site='https://dl.yarnpkg.com/debian'
|
||||
yarn_key_url="$yarn_site/pubkey.gpg"
|
||||
local_yarn_key="$keyring/yarnkey.gpg"
|
||||
|
||||
print_status """Run \`${bold}sudo apt-get install -y ${NODEPKG}${normal}\` to install ${NODENAME} and npm
|
||||
## You may also need development tools to build native addons:
|
||||
sudo apt-get install gcc g++ make
|
||||
## To install the Yarn package manager, run:
|
||||
curl -sL $yarn_key_url | gpg --dearmor | sudo tee $local_yarn_key >/dev/null
|
||||
echo \"deb [signed-by=$local_yarn_key] $yarn_site stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get update && sudo apt-get install yarn
|
||||
"""
|
||||
|
||||
}
|
||||
|
||||
## Defer setup until we have the complete script
|
||||
setup
|
||||
11
images/node-base/Dockerfile
Normal file
11
images/node-base/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM node:18-alpine
|
||||
|
||||
RUN apk update && apk add git curl jq && mkdir -p /opt
|
||||
|
||||
COPY --chown=root:root wait-for.sh /opt/wait-for
|
||||
|
||||
RUN chmod +x /opt/wait-for && ln -s /opt/wait-for /usr/local/bin/wait-for
|
||||
|
||||
USER node
|
||||
|
||||
CMD []
|
||||
20
images/node-base/package.json
Normal file
20
images/node-base/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@openstapps/node-base",
|
||||
"version": "3.0.0-next.3",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"contributors": [
|
||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||
"Michel Jonathan Schmitz",
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"files": [
|
||||
"Dockerfile",
|
||||
"README.md",
|
||||
"CHANGELOG.md"
|
||||
]
|
||||
}
|
||||
184
images/node-base/wait-for.sh
Normal file
184
images/node-base/wait-for.sh
Normal file
@@ -0,0 +1,184 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2017 Eficode Oy
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
set -- "$@" -- "$TIMEOUT" "$QUIET" "$PROTOCOL" "$HOST" "$PORT" "$result"
|
||||
TIMEOUT=15
|
||||
QUIET=0
|
||||
# The protocol to make the request with, either "tcp" or "http"
|
||||
PROTOCOL="tcp"
|
||||
|
||||
echoerr() {
|
||||
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
exitcode="$1"
|
||||
cat << USAGE >&2
|
||||
Usage:
|
||||
$0 host:port|url [-t timeout] [-- command args]
|
||||
-q | --quiet Do not output any status messages
|
||||
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
|
||||
-- COMMAND ARGS Execute command with args after the test finishes
|
||||
USAGE
|
||||
exit "$exitcode"
|
||||
}
|
||||
|
||||
wait_for() {
|
||||
case "$PROTOCOL" in
|
||||
tcp)
|
||||
if ! command -v nc >/dev/null; then
|
||||
echoerr 'nc command is missing!'
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
wget)
|
||||
if ! command -v wget >/dev/null; then
|
||||
echoerr 'wget command is missing!'
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
while :; do
|
||||
case "$PROTOCOL" in
|
||||
tcp)
|
||||
nc -w 1 -z "$HOST" "$PORT" > /dev/null 2>&1
|
||||
;;
|
||||
http)
|
||||
wget --timeout=1 -q "$HOST" -O /dev/null > /dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
echoerr "Unknown protocol '$PROTOCOL'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
result=$?
|
||||
|
||||
if [ $result -eq 0 ] ; then
|
||||
if [ $# -gt 7 ] ; then
|
||||
for result in $(seq $(($# - 7))); do
|
||||
result=$1
|
||||
shift
|
||||
set -- "$@" "$result"
|
||||
done
|
||||
|
||||
TIMEOUT=$2 QUIET=$3 PROTOCOL=$4 HOST=$5 PORT=$6 result=$7
|
||||
shift 7
|
||||
exec "$@"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$TIMEOUT" -le 0 ]; then
|
||||
break
|
||||
fi
|
||||
TIMEOUT=$((TIMEOUT - 1))
|
||||
|
||||
sleep 1
|
||||
done
|
||||
echo "Operation timed out" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while :; do
|
||||
case "$1" in
|
||||
http://*|https://*)
|
||||
HOST="$1"
|
||||
PROTOCOL="http"
|
||||
shift 1
|
||||
;;
|
||||
*:* )
|
||||
HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
|
||||
PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
|
||||
shift 1
|
||||
;;
|
||||
-q | --quiet)
|
||||
QUIET=1
|
||||
shift 1
|
||||
;;
|
||||
-q-*)
|
||||
QUIET=0
|
||||
echoerr "Unknown option: $1"
|
||||
usage 1
|
||||
;;
|
||||
-q*)
|
||||
QUIET=1
|
||||
result=$1
|
||||
shift 1
|
||||
set -- -"${result#-q}" "$@"
|
||||
;;
|
||||
-t | --timeout)
|
||||
TIMEOUT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t*)
|
||||
TIMEOUT="${1#-t}"
|
||||
shift 1
|
||||
;;
|
||||
--timeout=*)
|
||||
TIMEOUT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
--help)
|
||||
usage 0
|
||||
;;
|
||||
-*)
|
||||
QUIET=0
|
||||
echoerr "Unknown option: $1"
|
||||
usage 1
|
||||
;;
|
||||
*)
|
||||
QUIET=0
|
||||
echoerr "Unknown argument: $1"
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [ "$TIMEOUT" -ge 0 ] 2>/dev/null; then
|
||||
echoerr "Error: invalid timeout '$TIMEOUT'"
|
||||
usage 3
|
||||
fi
|
||||
|
||||
case "$PROTOCOL" in
|
||||
tcp)
|
||||
if [ "$HOST" = "" ] || [ "$PORT" = "" ]; then
|
||||
echoerr "Error: you need to provide a host and port to test."
|
||||
usage 2
|
||||
fi
|
||||
;;
|
||||
http)
|
||||
if [ "$HOST" = "" ]; then
|
||||
echoerr "Error: you need to provide a host to test."
|
||||
usage 2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
wait_for "$@"
|
||||
7
images/node-builder/Dockerfile
Normal file
7
images/node-builder/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM node:18-alpine
|
||||
|
||||
RUN apk update && apk add git jq curl python3 build-base
|
||||
|
||||
RUN npm install turbo pnpm --global
|
||||
|
||||
CMD []
|
||||
20
images/node-builder/package.json
Normal file
20
images/node-builder/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@openstapps/node-builder",
|
||||
"version": "3.0.0-next.3",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"contributors": [
|
||||
"Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||
"Michel Jonathan Schmitz",
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>",
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"files": [
|
||||
"Dockerfile",
|
||||
"README.md",
|
||||
"CHANGELOG.md"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user