Commit 226c27a1 authored by Michał 'rysiek' Woźniak's avatar Michał 'rysiek' Woźniak
Browse files

support and documentation for INSTALL_PACKAGES build arg added

parent 5ff5e665
......@@ -13,6 +13,26 @@ RUN DEBIAN_FRONTEND=noninteractive \
# install additional stuff needed for our cron scripts
RUN DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends openssh-client curl
# we might need to install some packages, but doing this in the entrypoint doesn't make any sense
ARG INSTALL_PACKAGES=
RUN if [ "$INSTALL_PACKAGES" != "" ]; then \
MAINLINE_PACKAGES="$( echo "$INSTALL_PACKAGES" | tr ' ' '\n' | egrep -v ':backports$' | tr '\n' ' ' )"; \
echo "* * * MAINLINE_PACKAGES: $MAINLINE_PACKAGES"; \
BACKPORTS_PACKAGES="$( echo "$INSTALL_PACKAGES" | tr ' ' '\n' | egrep ':backports$' | sed -r -e 's/:backports$//' | tr '\n' ' ' )"; \
echo "* * * BACKPORTS_PACKAGES: $BACKPORTS_PACKAGES"; \
[ "$BACKPORTS_PACKAGES" != "" ] && echo "deb http://ftp.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list ; \
export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y \
$MAINLINE_PACKAGES \
--no-install-recommends && \
if [ "$BACKPORTS_PACKAGES" != "" ]; then \
apt-get install -y \
-t jessie-backports \
$BACKPORTS_PACKAGES \
--no-install-recommends ; \
fi; \
rm -rf /var/lib/apt/lists/* ; \
fi
# we need to make sure that /etc/cron.* cronjobs are not run as root
# it's not required for the operation (after all, all the cronjobs are to be
......
......@@ -14,6 +14,16 @@ It might make good sense to volume-mount the following directories:
- `/etc/cron.hourly/` (can be read-only)
- `/etc/cron.monthly/` (can be read-only)
## [Build args](https://docs.docker.com/engine/reference/builder/#arg)
- `INSTALL_PACKAGES` (default: empty)
Space-separated list of packages to be installed upon building the container. This is the preferred way of installing packages in the image. All packages are installed with `--no-install-recommend` flag passed to `apt-get`.
Installing packages from [Debian Backports](https://backports.debian.org/) is supported by appending `:backports` to a package name. The backports repository will be added automagically if there is at least one package to be installed from it.
For example, setting `INSTALL_PACKAGES` to `tmux:backports screen` will install `screen` from the main repository, then set-up `jessie-backports`, and install `tmux` from there. This also works with package versions and regexen: setting `INSTALL_PACKAGES` to `tmux=2.2-1~bpo8+1:backports` will set-up `jessie-backports` and install version `2.2-1~bpo8+1` of `tmux` from there; setting `INSTALL_PACKAGES` to `vim*:backports` will set-up `jessie-backports` and install all packages whise names start with `vim` from there,
## Environment variables
- `SSH_KNOWN_HOSTS` (default: empty)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment