Added Fedora to the available Docker base images.

This commit is contained in:
Fabio Manganiello 2023-09-22 19:02:13 +02:00
parent 761f2768cb
commit a872d6f554
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
5 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,26 @@
FROM fedora
ADD . /install
WORKDIR /var/lib/platypush
ARG DOCKER_CTX=1
ENV DOCKER_CTX=1
# Enable the RPM Fusion repository
RUN dnf install -y \
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
RUN /install/platypush/install/scripts/fedora/install.sh
RUN cd /install && pip install -U --no-input --no-cache-dir .
RUN rm -rf /install
RUN dnf clean all -y
EXPOSE 8008
VOLUME /etc/platypush
VOLUME /var/lib/platypush
CMD platypush \
--start-redis \
--config /etc/platypush/config.yaml \
--workdir /var/lib/platypush

View File

@ -0,0 +1 @@
dnf install -y

View File

@ -0,0 +1,28 @@
#!/bin/sh
# This script parses the system requirements for a specific OS and it runs the
# appropriate package manager command to install them.
# This script is usually symlinked in the folders of the individual operating
# systems, and it's not supposed to be invoked directly.
# Instead, it will be called either by the root install.sh script or by a
# Dockerfile.
SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
OS="$(basename "$SCRIPT_PATH")"
CMD="$(cat "${SCRIPT_PATH}/PKGCMD")"
REQUIREMENTS="$(cat "${SCRIPT_PATH}/../../requirements/${OS}.txt" | tr '\n' ' ')"
SUDO=
# If we aren't running in a Docker context, or the user is not root, we should
# use sudo to install system packages.
if [ $(id -u) -ne 0 ] || [ -z "$DOCKER_CTX" ]; then
if ! type sudo >/dev/null; then
echo "sudo executable not found, I can't install system packages" >&2
exit 1
fi
SUDO="sudo"
fi
${SUDO_ARGS} ${CMD} ${REQUIREMENTS}

View File

@ -35,6 +35,7 @@ class DockerBuilder(BaseBuilder):
_pkg_manager_by_base_image = {
BaseImage.ALPINE: PackageManagers.APK,
BaseImage.DEBIAN: PackageManagers.APT,
BaseImage.FEDORA: PackageManagers.DNF,
BaseImage.UBUNTU: PackageManagers.APT,
}

View File

@ -42,6 +42,7 @@ class BaseImage(Enum):
ALPINE = 'alpine'
DEBIAN = 'debian'
FEDORA = 'fedora'
UBUNTU = 'ubuntu'
def __str__(self) -> str:
@ -129,6 +130,15 @@ class PackageManagers(Enum):
parse_list_line=lambda line: line.split('/')[0],
)
DNF = PackageManager(
executable='dnf',
install=('dnf', 'install', '-y'),
uninstall=('dnf', 'remove', '-y'),
list=('dnf', 'list', '--installed'),
default_os='fedora',
parse_list_line=lambda line: re.split(r'\s+', line)[0].split('.')[0],
)
PACMAN = PackageManager(
executable='pacman',
install=('pacman', '-S', '--noconfirm', '--needed'),