Initial commit

This commit is contained in:
2024-02-01 12:24:58 +01:00
commit dab8585fab
16 changed files with 1532 additions and 0 deletions

123
.bashrc Normal file
View File

@@ -0,0 +1,123 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
export HISTFILE=@HISTFILE@
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;33m\]\u\[\033[01;33m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
cd @START_PATH@
while IFS= read -r line; do echo -e "$line"; done < /etc/terminal-splash.txt
echo -e "--------------------------------------------------------------"
echo -e "Tuxbox-Builder Version: @VERSION@"
echo -e "--------------------------------------------------------------"
echo -e ""

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
.git
.github
.gitignore
.dockerignore
Dockerfile
*.md

33
.env.sample Normal file
View File

@@ -0,0 +1,33 @@
BUILDENV_GIT_URL=https://github.com/tuxbox-neutrino/buildenv.git
BUILDENV_VERSION=3.2.4
BUILDENV_PREFIX=buildenv
TB_BUILD_TIME=
DISPLAY=:0
ENABLE_UI_TOOLS=false
GIT_EMAIL=${USER}@localhost
GIT_USER=${USER}
HISTFILE=/home/${USER}/tuxbox/.data/.bash_history
HISTFILE_NAME=.bash_history
HOST_PREFIX=tuxbox
LANGUAGE=de_DE.UTF-8
LC_ALL=de_DE.UTF-8
LOCALE_LANG=de_DE.UTF-8
LOCAL_HOSTNAME=localhost
NVIDIA_VISIBLE_DEVICES=all
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
QT_QUICK_BACKEND=software
QT_XCB_GL_INTEGRATION=xcb_egl
START_PATH=/home/${USER}/tuxbox/buildenv
TERM=xterm-256color
TZ=Europe/Berlin
USER=${USER}
USER_DIR=/home/${USER}
USER_GROUP=${USER}
USER_GROUP_ID=1000
USER_ID=1000
USER_PASSWORD=${USER}
USER_VOLUME_WORKDIR=/home/${USER}/tuxbox
USER_VOLUME_DATADIR=/home/${USER}/tuxbox/.data
TB_VERSION=
XDG_CONFIG_HOME=/home
XDG_RUNTIME_DIR=/tmp/runtime-root

25
.github/scripts/translate.py vendored Normal file
View File

@@ -0,0 +1,25 @@
from googletrans import Translator
def translate_readme(input_text, target_lang):
translator = Translator()
translated = translator.translate(input_text, dest=target_lang)
translated_text = translated.text
# add hint for automatically translation
translated_text = f"Note: This is an automatically translated file. Original content from [here](https://github.com/dbt1/docker-tuxbox-build/blob/master/README-de.md):\n\n{translated_text}"
# Use this workaround, because translater breaks some links and anchors
translated_text = translated_text.replace("[Build Image](#Build Image)", "[Build Image](#build-image)")
translated_text = translated_text.replace("devtool -reference.html", "devtool-reference.html")
translated_text = translated_text.replace("dev-manual -common-tasks.html", "dev-manual-common-tasks.html")
translated_text = translated_text.replace("Clone #1-Init-Script", "#1-clone-init-script")
return translated_text
if __name__ == "__main__":
input_text = open("README-de.md", "r").read()
target_lang = "en" # target language is english
translated_text = translate_readme(input_text, target_lang)
with open("README-en.md", "w") as outfile:
outfile.write(translated_text)

42
.github/workflows/readme.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Translate README
on:
push:
branches:
- master
paths:
- 'README-de.md'
permissions:
contents: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade googletrans==3.1.0a0
- name: Translate README
run: |
python .github/scripts/translate.py
- name: Commit and push translated README
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git add README-en.md
git commit -m "readme: Automatically translated README to English"
git push

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# This .env file will be generarted by create-env.sh
.env
.gitconfig
.directory
init.sh
*-swp

255
Dockerfile Normal file
View File

@@ -0,0 +1,255 @@
## Use the official Debian 11 image as a base
# FROM debian:bullseye-slim
FROM dbt1/git-tools
### Install the required tools and packages
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
bzip2 \
binutils \
build-essential \
chrpath \
clisp \
coreutils \
cpio \
cppcheck \
curl \
debianutils \
default-jre \
diffstat \
diffutils \
doxygen \
file \
gcc \
gcc-multilib \
git-core \
gnupg \
gawk \
iputils-ping \
libc-bin \
libc6 \
libcapstone4 \
libegl1-mesa \
libsdl1.2debian \
libsdl2-dev \
libxml2-utils \
lighttpd \
linux-libc-dev \
locales-all \
locales \
make \
nano \
net-tools \
ninja-build \
openssh-server \
passwd \
procps \
pylint3 \
python \
python3 \
python3-git \
python3-jinja2 \
python3-pexpect \
rsync \
runit \
sed \
socat \
subversion \
sudo \
texinfo \
tree \
unzip \
util-linux \
wget
### Args
ARG BUILDENV_GIT_URL=${BUILDENV_GIT_URL}
ARG BUILDENV_VERSION=${BUILDENV_VERSION}
ARG BUILDENV_PREFIX=${BUILDENV_PREFIX}
ARG TB_BUILD_TIME=${TB_BUILD_TIME}
ARG DISPLAY=${DISPLAY}
ARG ENABLE_UI_TOOLS=false
ARG GIT_EMAIL=${GIT_EMAIL}
ARG GIT_USER=${GIT_USER}
ARG USER_GROUP_ID=${USER_GROUP_ID}
ARG HISTFILE=${HISTFILE}
ARG HOST_PREFIX=${HOST_PREFIX}
ARG LOCALE_LANG=${LOCALE_LANG}
ARG LOCAL_HOSTNAME=${LOCAL_HOSTNAME}
ARG NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}
ARG PATH=${PATH}
ARG QT_QUICK_BACKEND=${QT_QUICK_BACKEND}
ARG QT_XCB_GL_INTEGRATION=${QT_XCB_GL_INTEGRATION}
ARG START_PATH=${START_PATH}
ARG TERM=${TERM}
ARG TZ=${TZ}
ARG USER=${USER}
ARG USER_DIR=${USER_DIR}
ARG USER_GROUP=${USER_GROUP}
ARG USER_ID=${USER_ID}
ARG USER_PASSWORD=${USER_PASSWORD}
ARG USER_VOLUME_WORKDIR=${USER_DIR}/${HOST_PREFIX}
ARG TB_VERSION=${TB_VERSION}
ARG XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
ARG XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}
## Set the desired Locale
RUN locale-gen ${LOCALE_LANG} && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=${LOCALE_LANG}
### Some labels
LABEL maintainer="Thilo Graf <dbt@novatux.de>" \
maintainer.org="tuxbox-neutrino" \
maintainer.org.uri="https://tuxbox-neutrino.org" \
com.tuxbox-neutrino.project.repo.type="git" \
com.tuxbox-neutrino.project.repo.uri="https://github.com/dbt1/docker-tuxbox-build" \
com.tuxbox-neutrino.project.repo.issues="https://github.com/dbt1/docker-tuxbox-build/issues" \
com.tuxbox-neutrino.app.docker-tuxbox-build.version="${TB_VERSION}" \
# Open container labels
org.opencontainers.image.created="${TB_BUILD_TIME}" \
org.opencontainers.image.description="Debian based" \
org.opencontainers.image.vendor="tuxbox-neutrino" \
org.opencontainers.image.source="https://github.com/dbt1/docker-tuxbox-build" \
# Artifact hub annotations
io.artifacthub.package.readme-url="https://github.com/dbt1/docker-tuxbox-build/blob/master/README.md" \
io.artifacthub.package.logo-url="https://avatars.githubusercontent.com/u/22789022?s=200&v=4"
### ui package experimental atm
RUN if [ "$ENABLE_UI_TOOLS" = "true" ]; then \
apt-get update && apt-get install -y --no-install-recommends \
breeze-icon-theme \
meld \
dbus \
kdevelop; \
fi
## avoid dbus warn messages
ENV NO_AT_BRIDGE=1
## Create some basic directories and permissions for X-Server
RUN mkdir -p $XDG_RUNTIME_DIR && chown -R root:root $XDG_RUNTIME_DIR && chmod 0700 $XDG_RUNTIME_DIR
### Terminal
## Copy welcome message
ENV BANNER_FILE=/etc/welcome.txt
COPY terminal-splash.txt /etc/terminal-splash.txt
RUN cat /etc/terminal-splash.txt > ${BANNER_FILE} && \
echo "--------------------------------------------------------------" >> ${BANNER_FILE} && \
echo "Tuxbox-Builder Version: ${TB_VERSION}" >> ${BANNER_FILE} && \
echo "--------------------------------------------------------------" >> ${BANNER_FILE}
### ssh stuff
RUN mkdir /var/run/sshd && \
ssh-keygen -A && \
mkdir -p /etc/service/sshd && \
echo '#!/bin/sh' > /etc/service/sshd/run && \
echo 'exec /usr/sbin/sshd -D' >> /etc/service/sshd/run && \
chmod 755 /etc/service/sshd/run
### Set timzone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
## Add the user with default password
RUN groupadd -g "${USER_GROUP_ID}" "${USER_GROUP}" && \
useradd -m -u "${USER_ID}" -g "${USER_GROUP_ID}" -s /bin/bash "${USER}" && \
echo "${USER}:${USER_PASSWORD}" | chpasswd
## Lighttpd setup and create the runit service for lighttpd
ENV LIGHTTPD_RUN="/etc/service/lighttpd/run"
ENV LIGHTTPD_CONFIG_PATH="/config/lighttpd"
ENV LIGHTTPD_STD_CONFIG_FILE="${LIGHTTPD_CONFIG_PATH}/lighttpd.conf"
ENV LIGHTTPD_CONF_INC="${LIGHTTPD_CONFIG_PATH}/lighttpd.conf.inc"
RUN mkdir -p /etc/service/lighttpd && \
echo '#!/bin/sh' > ${LIGHTTPD_RUN} && \
echo "if [ ! -d ${LIGHTTPD_CONFIG_PATH} ]; then" >> ${LIGHTTPD_RUN} && \
echo " mkdir -p ${LIGHTTPD_CONFIG_PATH}" >> ${LIGHTTPD_RUN} && \
echo "fi" >> ${LIGHTTPD_RUN} && \
echo "" >> ${LIGHTTPD_RUN} && \
echo "if [ ! -f ${LIGHTTPD_STD_CONFIG_FILE} ]; then" >> ${LIGHTTPD_RUN} && \
echo " cp /etc/lighttpd/lighttpd.conf ${LIGHTTPD_STD_CONFIG_FILE}" >> ${LIGHTTPD_RUN} && \
echo " echo 'dir-listing.activate = \"enable\"' >> ${LIGHTTPD_STD_CONFIG_FILE}" >> ${LIGHTTPD_RUN} && \
echo " sed -i 's|/var/www/html|${USER_VOLUME_WORKDIR}/${BUILDENV_PREFIX}/dist|' ${LIGHTTPD_STD_CONFIG_FILE}" >> ${LIGHTTPD_RUN} && \
echo "fi" >> ${LIGHTTPD_RUN} && \
echo "" >> ${LIGHTTPD_RUN} && \
echo "exec lighttpd -D -f ${LIGHTTPD_STD_CONFIG_FILE}" >> ${LIGHTTPD_RUN} && \
chmod 755 ${LIGHTTPD_RUN}
### generate content of start script ###
ENV CONTAINER_INIT_SCRIPT="/usr/local/bin/init.sh"
RUN echo "#!/bin/bash" > ${CONTAINER_INIT_SCRIPT} && \
echo "echo 'Initialize tuxbox-builder container...'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "chown -R ${USER}:${USER_GROUP} ${USER_DIR} ${USER_VOLUME_DATADIR}" >> ${CONTAINER_INIT_SCRIPT}
## prepare git config
#COPY .gitconfig ${USER_DIR}/.gitconfig
RUN mkdir -p ${XDG_CONFIG_HOME}/git && \
echo "echo -e '[user]\\n\\temail = ${GIT_EMAIL}\\n\\tname = ${GIT_USER}' > ${XDG_CONFIG_HOME}/git/config" >> ${CONTAINER_INIT_SCRIPT} && \
echo "chown -R ${USER}:${USER_GROUP} ${XDG_CONFIG_HOME}/git" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo " >> ${CONTAINER_INIT_SCRIPT}
## Prepare buildenv script
RUN echo "if [ ! -d ${START_PATH}/.git ]; then" >> ${CONTAINER_INIT_SCRIPT} && \
echo " echo Cloning buildenv Repository from ${BUILDENV_GIT_URL}" >> ${CONTAINER_INIT_SCRIPT} && \
echo " git clone ${BUILDENV_GIT_URL} /tmp/${BUILDENV_PREFIX}" >> ${CONTAINER_INIT_SCRIPT} && \
echo " rsync -a /tmp/${BUILDENV_PREFIX} ${USER_VOLUME_WORKDIR}/" >> ${CONTAINER_INIT_SCRIPT} && \
echo " rm -rf ${USER_DIR}/${BUILDENV_PREFIX}/tmp" >> ${CONTAINER_INIT_SCRIPT} && \
echo "else" >> ${CONTAINER_INIT_SCRIPT} && \
echo " echo 'Repository [${START_PATH}] already exists. Not touched!'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "fi" >> ${CONTAINER_INIT_SCRIPT}
## prepare profile
COPY .bashrc ${USER_DIR}/.bashrc
RUN echo "sed -i 's|@START_PATH@|'"${START_PATH}"'|' ${USER_DIR}/.bashrc" >> ${CONTAINER_INIT_SCRIPT} && \
echo "sed -i 's|@VERSION@|'"${TB_VERSION}"'|' ${USER_DIR}/.bashrc" >> ${CONTAINER_INIT_SCRIPT} && \
echo "sed -i 's|@HISTFILE@|'"${HISTFILE}"'|' ${USER_DIR}/.bashrc" >> ${CONTAINER_INIT_SCRIPT}
## prepare ssh config
RUN echo "mkdir -p ${USER_DIR}/.ssh" >> ${CONTAINER_INIT_SCRIPT}
## show env info
RUN echo "echo " >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo Environment:" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo BUILDENV_VERSION='${BUILDENV_VERSION}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo HOST_PREFIX='${HOST_PREFIX}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo BUILDENV_PREFIX='${BUILDENV_PREFIX}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo BUILDENV_GIT_URL='${BUILDENV_GIT_URL}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo TZ='${TZ}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo USER='${USER}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo USER_GROUP='${USER_GROUP}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo USER_ID='${USER_ID}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo USER_GROUP_ID='${USER_GROUP_ID}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo USER_DIR='${HOME}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo USER_PASSWORD=******" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo HISTFILE='${HISTFILE}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo GIT_USER='${GIT_USER}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo GIT_EMAIL='${GIT_EMAIL}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo PATH='${PATH}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo LOCALE_LANG='${LOCALE_LANG}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo START_PATH='${START_PATH}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo TB_VERSION='${TB_VERSION}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo TB_BUILD_TIME='${TB_BUILD_TIME}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo DISPLAY='${DISPLAY}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo ENABLE_UI_TOOLS='${ENABLE_UI_TOOLS} NOTE: Experimental only!'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo LOCAL_HOSTNAME='${LOCAL_HOSTNAME}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo HOSTNAME='$HOSTNAME'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo XDG_RUNTIME_DIR='${XDG_RUNTIME_DIR}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo XDG_CONFIG_HOME='${XDG_CONFIG_HOME}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo QT_QUICK_BACKEND='${QT_QUICK_BACKEND}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo QT_XCB_GL_INTEGRATION='${QT_XCB_GL_INTEGRATION}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo NVIDIA_VISIBLE_DEVICES='${NVIDIA_VISIBLE_DEVICES}'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "echo " >> ${CONTAINER_INIT_SCRIPT}
## start services
RUN echo "echo 'Ready...'" >> ${CONTAINER_INIT_SCRIPT} && \
echo "exec runsvdir -P /etc/service" >> ${CONTAINER_INIT_SCRIPT}
### END generate content of start script ###
# clean up
RUN apt-get autoremove -y && apt-get autoclean && apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## make start script executable
RUN chmod 755 "${CONTAINER_INIT_SCRIPT}"
# Start container with init script
ENTRYPOINT ["bash", "-c", "${CONTAINER_INIT_SCRIPT}"]
CMD ["D"]

339
LICENSE Normal file
View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

243
README-de.md Normal file
View File

@@ -0,0 +1,243 @@
Dieses Repository enthält die notwendigen Dateien, um einen Docker-Container zu konfigurieren, zu erzeugen und zu starten, einschließlich `docker-compose.yaml`, `Dockerfile` und Skripte. Einige Umgebungsvariablen werden in eine `.env`-Datei hinterlegt, die mit einem Script `create-env.sh` erzeugt werden müssen, weil einige Einstellungen vom Host-System benötigt werden.
Die Verwendung dieses Dockerimages soll helfen, Docker-Container zu erzeugen, die die notwendigen Voraussetzungen bereitstellen, um Flashimages und Pakete mit dem Yocto/OE Buildsystem bauen zu können.
- [1. Voraussetzungen](#1-voraussetzungen)
- [2. Vorbereiten](#2-vorbereiten)
- [2.1. Repository klonen und in das geklonte Repo wechseln](#21-repository-klonen-und-in-das-geklonte-repo-wechseln)
- [2.2. Umgebungsvariablen konfigurieren](#22-umgebungsvariablen-konfigurieren)
- [2.3 Volumes](#23-volumes)
- [2.4 Ports konfigurieren](#24-ports-konfigurieren)
- [2.4.1 Webzugriff](#241-webzugriff)
- [2.4.2 SSH](#242-ssh)
- [3. Container bauen](#3-container-bauen)
- [3.1 Beispiel 1](#31-beispiel-1)
- [3.2 Beispiel 2](#32-beispiel-2)
- [4. Container starten](#4-container-starten)
- [5. Container stoppen](#5-container-stoppen)
- [6. Verwenden des Containers](#6-verwenden-des-containers)
- [6.1. Einloggen](#61-einloggen)
- [6.2. Buildumgebung nutzen](#62-buildumgebung-nutzen)
- [7. Unterstützung](#7-unterstützung)
## 1. Voraussetzungen
Getestet wurde unter Linux Debian 11.x, Ubuntu 20.04, 22.04. Es sollte aber auf jeder aktuellen Distribution funktionieren auf der Docker läuft.
Erforderlich:
- Docker, [Installation](https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script)
- Docker Compose >= v2.24.3, [Installation](https://docs.docker.com/compose/install/standalone/)
- Git, Installation über den Paketmanager je nach Distribution
Optional:
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
- Portainer, [Installation](https://docs.portainer.io/start/install-ce/server/docker/linux) (mit Docker-Desktop als Plugin verfügbar)
**Wichtig!** Nachdem Du Docker installiert hast und Docker als nicht Root Benutzer ausführen möchtest, was für unsere Zwecke durchaus angebracht ist, solltest Du dich mit diesem Befehl als Benutzer zur "docker" Gruppe hinzufügen:
```bash
sudo usermod -aG docker $USER
```
Danach zum Übernehmen der Einstellung entweder ausloggen und wieder einloggen oder einen Neustart durchführen!
## 2. Vorbereiten
### 2.1. Repository klonen und in das geklonte Repo wechseln
```bash
git clone https://github.com/dbt1/docker-tuxbox-build.git && cd docker-tuxbox-build
```
### 2.2. Umgebungsvariablen konfigurieren
Führe dieses Script aus, um die notwendige `.env`-Datei zu erzeugen:
```bash
./create-env.sh
```
Das Script holt einige Umgebungsvariablen vom Host-System und passt, bzw. baut, diese in eine `.env`-Datei ein, damit der Container passend zu deinem Host-System konfiguriert wird. Sollten damit deine Anforderungen noch nicht abgedeckt sein, kannst Du diese erzeugte `.env`-Datei anpassen. Das Script solltest Du dann aber nicht noch einnmal ausführen, da die `.env`-Datei sonst wieder überschrieben wird. Es ist daher ratsam, etweder diese angepasste `.env`-Datei umzubenennen und entsprechend ebenfalls in der `docker-compose.yml`-Datei umbenennen, oder bevorzugt beim ausführen von `docker-compose` als Parameter eine andere in dieser Form `--env-file <meine .env-Datei>` an `docker-compose` übegeben.
### 2.3 Volumes
Der Container verwendet Docker Volumes, um persistente Daten zu speichern, welche Zugriff auf spezifische Dateien und Verzeichnisse dauerhaft im Container ermöglichen.
In der Standardkonfiguration werden prinzipell diese Volumes passend zur Umgebung deines Host-Systems eingebunden und beim Starten des Containers eingehängt, so dass Du im Idealfall an der Volumes-Konfiguration nichts ändern musst.
Solltest Du daran Änderungen vornehmen wollen, findest Du in der `docker-compose.yml` die Konfiguration der Volumes. **Beachte** aber dass diese Einstellungem normalerweise mit den Pfaden wie sie für die Yocto/OE Buildumgebung mit dem init-Script aus dem Buildenv-Repository vorkonfiguriert werden, abgestimmt sind. Sollten daran Anpassungen vorgenommen werden, solltest Du das berücksichtigen!
Diese Pfade werden als Volumes im Container bereitgestellt. Du hast über dein Host darauf normalen Zugriff:
```bash
/home
└──<$USER>
├── tuxbox
│ ├── .config
│ ├── .data
│ ├── bin
│ └── buildenv
├── Archive
├── bin
├── sstate-cache
```
### 2.4 Ports konfigurieren
Der Container stellt einige Zugänge über bestimmte Netzwerkports zur Verfügung. Dies erlaubt den Zugang über einen Webbrowser auf die Buildergebnisse und den Zugang via ssh auf den Container.
#### 2.4.1 Webzugriff
Standardmäßig ist der Container so konfiguriert, dass er auf Port 80 lauscht. Dein Host wird über Port 8080 auf den eingebauten Webserver (`lighttpd`) des Containers gemappt:
- Port: 8080 (Host) -> 80 (Container)
Dies ermöglicht den Zugriff via Webserver auf die erzeugten Images und Pakete (ipk's). Set-Top Boxen können damit direkt Updates beispielsweise aus deinem Heimnetz abrufen. Falls der Port 8080 des Hostsystems bei Dir bereits belegt ist, kannst Du diese Einstellungen entweder in der `docker-compose.yml` Datei anpassen oder beim Starten des Containers angeben. Dies könnte so aussehen, wenn man auf den Port 8081 mappt:
- 808**1**:80
Einstellungen am Webserver können in der zuständigen lightttpd-Konfugarionsdatei vorgenommen werden, welche im entsprechenden Volume zur Verfügung steht:
```bash
~/tuxbox
└──.config
└── lighttpd
└── lighttpd.conf
```
In der `lighttpd.conf` ist `dir-listing` aktiviert, so dass man ohne zusätzlichen Content auskommt.
```bash
~/tuxbox/config/lighttpd$ cat lighttpd.conf
...
#server.compat-module-load = "disable"
server.modules += (
"mod_dirlisting",
"mod_staticfile",
)
dir-listing.activate = "enable"
```
#### 2.4.2 SSH
Üblicherweise greift man auf den Container direkt über `docker exec` zu.
Da Git ohnehin Bestandteil im Container ist, wird auch ein ssh-Server zur Verfügung gestellt. Der ssh-Server ist standardmäßig so konfiguriert:
- Port: 222 (Host) -> 22 (Container)
- Passwort: = Benutzername (wie in .env festgelegt)
Falls der Port 222 auf deinem Hostsystem bereits belegt wäre, kannst Du diese Einstellungen ebenso wie beim Webserver in der `docker-compose.yml` Datei anpassen oder beim Starten des Containers angeben.
Einloggen vom Host-System selbst:
```bash
ssh $USER@localhost -p 222
```
Einloggen von anderem Rechner:
```bash
ssh <benutzer>@<IP oder Hostname des Rechners auf dem der Container läuft> -p 222
```
## 3. Container bauen
### 3.1 Beispiel 1
Docker-compose Wrapper ausführen:
**Hinweis:** Das vorangestellte `./` ist hier wichtig, da es sich um ein Wrapperscript handelt, welches sich im Repo befindet und das echte `docker-compose` aufruft, aber vorher automatisch eine `.env`-Datei wie in [Schritt 2.2](#22-umgebungsvariablen-konfigurieren) beschrieben erzeugt! Dieses Wrapperscript nimmt alle Parameter an, die für `docker-compose` relevant sind. Das bedeutet, dass z.B. eine alternative `.env-Datei` verwendet werden kann. Dies soll lediglich den Aufwand für die Befehlseingabe verringern.
```bash
./docker-compose build
```
### 3.2 Beispiel 2
Docker-compose ausführen: mit anderer `.env-Datei`
**Hinweis:** im Repository ist eine `.env.sample` als Beispiel enthalten. Falls gewünscht, muss diese allerdings angepasst und explizit beim Erzeugen des Containers an `docker-compose` übergeben werden.
```bash
docker-compose --env-file <Pfad zu anderer .env-Datei> build
```
## 4. Container starten
```bash
docker-compose up -d
```
## 5. Container stoppen
```bash
docker-compose down
```
## 6. Verwenden des Containers
## 6.1. Einloggen
Man sollte den Namen oder die ID kennen, um sich einloggen zu können. Führe `docker ps` aus, um zu sehen, welche Container gerade verfügbar sind:
```bash
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9d6e0d280a9e tuxbox-build:latest "/usr/local/bin/star…" 41 minutes ago Up 41 minutes 0.0.0.0:8080->80/tcp tuxbox-build
```
Logge dich wie hier beispielsweise auf den Container mit der `Container-ID` **9d6e0d280a9e** oder dem `Container Namen` ein:
```bash
docker exec -it --user $USER 9d6e0d280a9e bash
```
oder:
```bash
docker exec -it --user $USER tuxbox-build bash
```
Es sollte etwa dieses Prompt erscheinen:
```bash
~/tuxbox/buildenv$
```
Zuerst solltest Du sicherstellen, dass das Init-Script aktuell ist. Führe deshalb eine Aktualisierung durch:
```bash
~/tuxbox/buildenv$ git pull -r origin master
```
Ab jetzt kannst Du mit dem Container arbeiten.
## 6.2. Buildumgebung nutzen
Nach dem Einloggen in den Container befindest Du dich bereits im Verzeichnis, in welchem sich das Init-Script befindet. Jetzt kannst du wie [hier](https://github.com/tuxbox-neutrino/buildenv/blob/master/README.md) beschrieben fortfahren.
Die vom Buildsystem erzeugten Images und Pakete werden über persistente Volumes innerhalb deines Home-Verzeichnisses des Hosts verfügbar gemacht. Standardmäßig ist dafür dieser Ort vorgesehen:
```bash
/home
└──<$USER>
├── tuxbox
: ├── buildenv
: ├── dist
:
```
**Hinweis:** Solltest Du deine Volumes anders eingerichtet haben, kann dies natürlich abweichen.
Der Container stellt einen Webserver zur Verfügung und ist lokal und im LAN standardmäßig über den Port 8080 erreichbar:
- [http://localhost<:PORT-NUMMER>](http://localhost:8080)
- [http://127.0.0.1<:PORT-NUMMER>](http://127.0.0.1:8080)
oder im LAN
- [http://IP<:PORT-NUMMER>](http://192.168.1.36:8080)
## 7. Unterstützung
Für weitere Fragen oder Unterstützung öffne ein [Issue im GitHub](https://github.com/dbt1/docker-tuxbox-build/issues) oder melde Dich im [Forum](https://forum.tuxbox-neutrino.org/forum/viewforum.php?f=77).

241
README-en.md Normal file
View File

@@ -0,0 +1,241 @@
Note: This is an automatically translated file. Original content from [here](https://github.com/dbt1/docker-tuxbox-build/blob/master/README-de.md):
This repository contains the necessary files to configure, build, and launch a Docker container, including `docker-compose.yaml`, `Dockerfile`, and scripts. Some environment variables are stored in a `.env` file, which must be created with a `create-env.sh` script because some settings are required by the host system.
The use of this Docker image is intended to help create Docker containers that provide the necessary requirements to be able to build Flash images and packages with the Yocto/OE build system.
- [1. Requirements](#1-requirements)
- [2. Prepare](#2-prepare)
- [2.1. Clone repository and switch to the cloned repo](#21-repository-clone-and-switch-to-the-cloned-repo)
- [2.2. Configure environment variables](#22-configure-environment-variables)
- [2.3 Volumes](#23-volumes)
- [2.4 Configure Ports](#24-ports-configure)
- [2.4.1 Web Access](#241-web access)
- [2.4.2 SSH](#242-ssh)
- [3. Build Container](#3-container-build)
- [3.1 Example 1](#31-example-1)
- [3.2 Example 2](#32-example-2)
- [4. Start container](#4-start-container)
- [5. Stop container](#5-stop-container)
- [6. Using the Container](#6-using-the-container)
- [6.1. Login](#61-login)
- [6.2. Use build environment](#62-build-environment-use)
- [7. Support](#7-support)
## 1. Requirements
Tested under Linux Debian 11.x, Ubuntu 20.04, 22.04. But it should work on any current distribution that runs Docker.
Necessary:
- Docker, [Installation](https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script)
- Docker Compose >= v2.24.3, [Installation](https://docs.docker.com/compose/install/standalone/)
- Git, installation via the package manager depending on the distribution
Optional:
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
- Portainer, [Installation](https://docs.portainer.io/start/install-ce/server/docker/linux) (available with Docker desktop as a plugin)
**Important!** After you have installed Docker and want to run Docker as a non-root user, which is appropriate for our purposes, you should add yourself as a user to the "docker" group using this command:
```bash
sudo usermod -aG docker $USER
```
Then to apply the setting, either log out and log in again or restart!
## 2. Prepare
### 2.1. Clone repository and switch to the cloned repo
```bash
git clone https://github.com/dbt1/docker-tuxbox-build.git && cd docker-tuxbox-build
```
### 2.2. Configure environment variables
Run this script to create the necessary `.env` file:
```bash
./create-env.sh
```
The script gets some environment variables from the host system and puts them into an `.env` file so that the container is configured to suit your host system. If this does not cover your requirements, you can adapt this generated `.env` file. However, you should not run the script again, otherwise the `.env` file will be overwritten again. It is therefore advisable to either rename this customized `.env` file and rename it accordingly in the `docker-compose.yml` file, or preferably to use another one in this form as a parameter when running `docker-compose` - -env-file <my .env file>` passed to `docker-compose`.
### 2.3 Volumes
The container uses Docker Volumes to store persistent data, which allows access to specific files and directories permanently in the container.
In the standard configuration, these volumes are in principle integrated to suit the environment of your host system and mounted when the container is started, so that ideally you do not have to change anything in the volume configuration.
If you want to make changes to this, you can find the configuration of the volumes in the `docker-compose.yml`. **Note** that these settings are normally aligned with the paths as preconfigured for the Yocto/OE build environment using the init script from the Buildenv repository. If adjustments are made to this, you should take this into account!
These paths are mounted as volumes in the container. You have normal access to it via your host:
```bash
/home
└──<$USER>
├── tuxbox
│ ├── .config
│ ├── .data
│ ├── am
│ └── buildenv
├── Archives
├── am
├── sstate cache
```
### 2.4 Configure ports
The container provides some access via certain network ports. This allows access to the build results via a web browser and access to the container via ssh.
#### 2.4.1 Web access
By default, the container is configured to listen on port 80. Your host is mapped to the container's built-in web server (`lighttpd`) via port 8080:
- Port: 8080 (host) -> 80 (container)
This enables access via web server to the generated images and packages (ipk's). Set-top boxes can therefore access updates directly from your home network, for example. If port 8080 on your host system is already in use, you can either adjust these settings in the `docker-compose.yml` file or specify them when starting the container. This could look like this if you map to port 8081:
- 808**1**:80
Settings on the web server can be made in the responsible lightttpd configuration file, which is available in the corresponding volume:
```bash
~/tuxbox
└──.config
└── lighttpd
└── lighttpd.conf
```
`dir-listing` is activated in `lighttpd.conf`, so that you can get by without additional content.
```bash
~/tuxbox/config/lighttpd$ cat lighttpd.conf
...
#server.compat-module-load = "disable"
server.modules += (
"mod_dirlisting",
"mod_staticfile",
)
dir-listing.activate = "enable"
```
#### 2.4.2 SSH
Usually you access the container directly via `docker exec`.
Since Git is already part of the container, an ssh server is also provided. By default, the ssh server is configured like this:
- Port: 222 (host) -> 22 (container)
- Password: = Username (as set in .env)
If port 222 is already occupied on your host system, you can adjust these settings in the `docker-compose.yml` file, just like with the web server, or specify them when starting the container.
Login from the host system itself:
```bash
ssh $USER@localhost -p 222
```
Log in from another computer:
```bash
ssh <user>@<IP or hostname of the computer on which the container is running> -p 222
```
## 3. Build containers
### 3.1 Example 1
Run docker-compose wrapper:
**Note:** The preceding `./` is important here because it is a wrapper script that is in the repo and calls the real `docker-compose`, but beforehand it automatically creates a `.env` file like described in [Step 2.2](#22-configure-environment-variables)! This wrapper script takes all parameters relevant to `docker-compose`. This means that, for example, an alternative `.env file` can be used. This is simply intended to reduce the effort involved in entering commands.
```bash
./docker-compose build
```
### 3.2 Example 2
Run docker-compose: with different `.env file`
**Note:** there is an `.env.sample` included in the repository as an example. However, if desired, this must be adjusted and explicitly passed to `docker-compose` when creating the container.
```bash
docker-compose --env-file <path to other .env file> build
```
## 4. Start container
```bash
docker-compose up -d
```
## 5. Stop containers
```bash
docker-compose down
```
## 6. Using the container
## 6.1. log in
You should know the name or ID to log in. Run `docker ps` to see which containers are currently available:
```bash
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9d6e0d280a9e tuxbox-build:latest "/usr/local/bin/star…" 41 minutes ago Up 41 minutes 0.0.0.0:8080->80/tcp tuxbox-build
```
For example, log in to the container with the `Container ID` **9d6e0d280a9e** or the `Container Name` like this:
```bash
docker exec -it --user $USER 9d6e0d280a9e bash
```
or:
```bash
docker exec -it --user $USER tuxbox-build bash
```
You should see something like this prompt:
```bash
~/tuxbox/buildenv$
```
First you should make sure that the init script is up to date. Therefore, carry out an update:
```bash
~/tuxbox/buildenv$ git pull -r origin master
```
From now on you can work with the container.
## 6.2. Use build environment
After logging into the container, you are already in the directory where the init script is located. Now you can continue as described [here](https://github.com/tuxbox-neutrino/buildenv/blob/master/README.md).
The images and packages produced by the build system are made available via persistent volumes within your host home directory. By default, this location is intended for this:
```bash
/home
└──<$USER>
├── tuxbox
: ├── buildenv
: ├── dist
:
```
**Note:** If you have set up your volumes differently, this may of course differ.
The container provides a web server and can be accessed locally and on the LAN via port 8080 by default:
- [http://localhost<:PORT NUMBER>](http://localhost:8080)
- [http://127.0.0.1<:PORT NUMBER>](http://127.0.0.1:8080)
or on the LAN
- [http://IP<:PORT NUMBER>](http://192.168.1.36:8080)
## 7. Support
For further questions or support, open an [Issue in GitHub](https://github.com/dbt1/docker-tuxbox-build/issues) or report in the [Forum](https://forum.tuxbox-neutrino.org /forum/viewforum.php?f=77).

7
README.md Normal file
View File

@@ -0,0 +1,7 @@
## Localized `README.md`'s
| Language |
| -------------------------- |
| [English](README-en.md) |
| [German](README-de.md) |

101
create-env.sh Executable file
View File

@@ -0,0 +1,101 @@
#!/bin/bash
# Path to.env-Datei
ENV_FILE=".env"
BUILDENV_VERSION="3.2.4"
TB_VERSION="latest"
TB_BUILD_TIME=$(date '+%Y-%m-%d %H:%M:%S')
USER=$(whoami)
USER_ID=$(id -u)
USER_GROUP_ID=$(id -g)
USER_DIR=${HOME}
HOST_PREFIX=tuxbox
BUILDENV_PREFIX="buildenv"
LOCAL_HOSTNAME=$(hostname)
ENABLE_UI_TOOLS="false"
USER_VOLUME_WORKDIR=${USER_DIR}/${HOST_PREFIX}
USER_VOLUME_DATADIR="${USER_VOLUME_WORKDIR}/.data"
TB_PATH="${USER_VOLUME_WORKDIR}/bin:${USER_DIR}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
HISTFILE_NAME=".bash_history"
HISTFILE="${USER_VOLUME_DATADIR}/${HISTFILE_NAME}"
# Set default values for GIT_EMAIL, GIT_USER
GIT_EMAIL="${USER}@${HOSTNAME}"
GIT_USER="$(grep "${USER}" /etc/passwd | cut -d: -f5 | sed 's/,//g')"
# Check if git is installed
if git --version &>/dev/null; then
# Git is installed, try to get global values
GLOBAL_EMAIL=$(git config --global user.email)
GLOBAL_USER=$(git config --global user.name)
if [ -z "$GLOBAL_USER" ]; then
GLOBAL_USER=$USER
fi
# Check if inside a Git repository
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
# Try to get local values if globals are not set
[ -z "$GLOBAL_EMAIL" ] && GIT_EMAIL=$(git config --local user.email) || GIT_EMAIL=$GLOBAL_EMAIL
[ -z "$GLOBAL_USER" ] && GIT_USER=$(git config --local user.name) || GIT_USER=$GLOBAL_USER
# Get version info
last_tag=$(git describe --tags --abbrev=0 2>/dev/null)
last_commit_id=$(git rev-parse --short HEAD)
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ -z "$last_tag" ]; then
commit_count=$(git rev-list --count HEAD)
TB_VERSION="git+${commit_count}-${last_commit_id}-${current_branch}"
else
commit_count=$(git rev-list --count ${last_tag}..HEAD)
TB_VERSION="${last_tag}.${commit_count}-${current_branch}"
fi
else
# Not inside a Git repo, use global values if available
GIT_EMAIL=${GLOBAL_EMAIL:-$GIT_EMAIL}
GIT_USER=${GLOBAL_USER:-$GIT_USER}
fi
else
echo "Git is not installed, using default values."
fi
# Create environment variables and write into .env
cat <<EOF >$ENV_FILE
BUILDENV_GIT_URL=https://github.com/tuxbox-neutrino/buildenv.git
BUILDENV_VERSION=${BUILDENV_VERSION}
BUILDENV_PREFIX=${BUILDENV_PREFIX}
TB_BUILD_TIME=${TB_BUILD_TIME}
DISPLAY=${DISPLAY}
ENABLE_UI_TOOLS=${ENABLE_UI_TOOLS}
GIT_EMAIL=${GIT_EMAIL}
GIT_USER=${GIT_USER}
HISTFILE=${HISTFILE}
HISTFILE_NAME=${HISTFILE_NAME}
HOST_PREFIX=${HOST_PREFIX}
LANGUAGE=${LANG}
LC_ALL=${LANG}
LOCALE_LANG=${LANG}
LOCAL_HOSTNAME=${LOCAL_HOSTNAME}
NVIDIA_VISIBLE_DEVICES=all
PATH=${TB_PATH}
QT_QUICK_BACKEND=software
QT_XCB_GL_INTEGRATION=xcb_egl
START_PATH=${USER_VOLUME_WORKDIR}/${BUILDENV_PREFIX}
TERM=${TERM}
TZ=$(cat /etc/timezone)
USER=${USER}
USER_DIR=${USER_DIR}
USER_GROUP=${USER}
USER_GROUP_ID=${USER_GROUP_ID}
USER_ID=${USER_ID}
USER_PASSWORD=${USER}
USER_VOLUME_WORKDIR=${USER_VOLUME_WORKDIR}
USER_VOLUME_DATADIR=${USER_VOLUME_DATADIR}
TB_VERSION=${TB_VERSION}
XDG_CONFIG_HOME=/home
XDG_RUNTIME_DIR=/tmp/runtime-root
EOF
# validate
echo ".env-file successfully created with:"
cat $ENV_FILE

1
docker-compose Symbolic link
View File

@@ -0,0 +1 @@
docker-compose-wrapper

16
docker-compose-wrapper Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Path to script that will be executed before starts docker-compose
ENV_SCRIPT="./create-env.sh"
# Check script
if [ -x "$ENV_SCRIPT" ]; then
echo "executing $ENV_SCRIPT..."
$ENV_SCRIPT
else
echo "Error: $ENV_SCRIPT not found or not executable."
exit 1
fi
# Execute docker-compose with all parameters an sub commannds
docker-compose "$@"

83
docker-compose.yml Normal file
View File

@@ -0,0 +1,83 @@
version: '3'
services:
tuxbox-build:
image: tuxbox-build
build:
context: .
dockerfile: Dockerfile
args:
- BUILDENV_GIT_URL=${BUILDENV_GIT_URL}
- BUILDENV_PREFIX=${BUILDENV_PREFIX}
- BUILDENV_VERSION=${BUILDENV_VERSION}
- DISPLAY=${DISPLAY}
- ENABLE_UI_TOOLS=false
- GIT_EMAIL=${GIT_EMAIL}
- GIT_USER=${GIT_USER}
- HISTFILE=${USER_VOLUME_DATADIR}/${HISTFILE_NAME}
- HISTFILE_NAME=${HISTFILE_NAME}
- HOST_PREFIX=${HOST_PREFIX}
- LOCALE_LANG=${LOCALE_LANG}
- LOCAL_HOSTNAME=${LOCAL_HOSTNAME}
- NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}
- PATH=${PATH}
- QT_QUICK_BACKEND=${QT_QUICK_BACKEND}
- QT_XCB_GL_INTEGRATION=${QT_XCB_GL_INTEGRATION}
- START_PATH=${START_PATH}
- TB_BUILD_TIME=${TB_BUILD_TIME}
- TB_VERSION=${TB_VERSION}
- TERM=${TERM}
- TZ=${TZ}
- USER=${USER}
- USER_DIR=${USER_DIR}
- USER_GROUP=${USER_GROUP}
- USER_GROUP_ID=${USER_GROUP_ID}
- USER_ID=${USER_ID}
- USER_PASSWORD=${USER_PASSWORD}
- USER_VOLUME_WORKDIR=${USER_DIR}/${HOST_PREFIX}
- USER_VOLUME_DATADIR=${USER_VOLUME_DATADIR}
- XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
- XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}
container_name: tuxbox-build
env_file:
- .env
#environment:
#- BUILDENV_VERSION=3.2.4
devices:
- /dev/dri:/dev/dri
ports:
# the host: container ports for web access, used for httpd inside container to get built packages and images via browser, wget, curl, set top boxes etc.
- "8080:80"
# the host: container ports for ssh access of users in its /home
- "222:22"
tty: true
working_dir: /
volumes:
- ${USER_VOLUME_WORKDIR}:${USER_VOLUME_WORKDIR}
- ${USER_DIR}/sstate-cache:${USER_DIR}/sstate-cache
- ${USER_DIR}/Archive:${USER_DIR}/Archive
- ${USER_DIR}/.ccache:${USER_DIR}/.ccache
- ${USER_DIR}/bin:${USER_DIR}/bin
- ${USER_VOLUME_WORKDIR}/bin:${USER_VOLUME_WORKDIR}/bin
- ${USER_DIR}/.ssh:${USER_DIR}/.ssh
- ${USER_VOLUME_WORKDIR}/.config:/config
- ${USER_VOLUME_WORKDIR}/.config/git/config:${XDG_CONFIG_HOME}/git
- /tmp/.X11-unix:/tmp/.X11-unix
- /usr/lib/x86_64-linux-gnu/mesa:/usr/lib/x86_64-linux-gnu/mesa
networks:
- tuxbox-network
#hostname: ${LOCAL_HOSTNAME}
cap_add:
- SYS_ADMIN
restart: unless-stopped
networks:
tuxbox-network:
driver: bridge
volumes:
tuxbox-volumes:
driver: local

10
terminal-splash.txt Normal file
View File

@@ -0,0 +1,10 @@
_____ ____ ____ _ _ _
|_ _| ___ _| __ ) _____ __ | __ ) _ _(_) | __| | ## .
| || | | \ \/ / _ \ / _ \ \/ / | _ \| | | | | |/ _` | ## ## ## ==
| || |_| |> <| |_) | (_) > < | |_) | |_| | | | (_| | ## ## ## ## ## ===
|_| \__,_/_/\_\____/ \___/_/\_\ |____/ \__,_|_|_|\__,_| /"""""""""""""""""\___/ ===
~~ ~~~~ ~~~ ~~~~ ~~~ ~~ ~~~~ ~~~ ~~~~ ~~~ ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
~~ ~~~~ ~~~ ~~~~ ~~~ \______ o __/
\ \ __/
\____\_______/