forked from platypush/platypush
Several Docker image improvements.
- Reduced size of the Ubuntu image by removing some unneeded packages (docutils, manpages, babel, fonts, python-pil etc.) that take a lot of space. - Better self-documented docker-compose.yml. - Added reference to the registry.platypush.tech/platypush image in docker-compose.yml (README reference will follow). - Fixed grep condition in the Docker prepare script. - Pass `--no-deps` to `pip install platypush`. The dependencies of the application, now that `marshmallow_dataclasses` has been removed, are all available in the package managers of the supported images (with the exception for croniter in Alpine Linux for now), so they can all be installed via system package manager rather than pip. This also prevents Ubuntu builds from breaking because system-installed packages are being overwritten with pip-installed copies.
This commit is contained in:
parent
2308c4e927
commit
9ebe251d46
5 changed files with 50 additions and 39 deletions
|
@ -1,24 +1,9 @@
|
|||
services:
|
||||
platypush:
|
||||
restart: "always"
|
||||
command:
|
||||
- platypush
|
||||
# Comment --start-redis if you want to run an external Redis service
|
||||
# In such case you'll also have to ensure that the appropriate Redis
|
||||
# variables are set in the .env file, or the Redis configuration is
|
||||
# passed in the config.yaml, or use the --redis-host and --redis-port
|
||||
# command-line options
|
||||
- --start-redis
|
||||
|
||||
# Custom list of host devices that should be accessible to the container -
|
||||
# e.g. an Arduino, an ESP-compatible microcontroller, a joystick etc.
|
||||
# devices:
|
||||
# - /dev/ttyUSB0
|
||||
|
||||
# Uncomment if you need plugins that require access to low-level hardware
|
||||
# (e.g. Bluetooth BLE or GPIO/SPI/I2C) if access to individual devices is
|
||||
# not enough or isn't practical
|
||||
# privileged: true
|
||||
# Replace the build section with the next line if instead of building the
|
||||
# image from a local checkout you want to pull the latest base
|
||||
# (Alpine-based) image from the remote registry
|
||||
# image: "registry.platypush.tech/platypush:latest"
|
||||
|
||||
build:
|
||||
context: .
|
||||
|
@ -31,6 +16,25 @@ services:
|
|||
# Fedora base image
|
||||
# dockerfile: ./platypush/install/docker/fedora.Dockerfile
|
||||
|
||||
restart: "always"
|
||||
command:
|
||||
- platypush
|
||||
- --redis-host
|
||||
- redis
|
||||
# Or, if you want to run Redis from the same container as Platypush,
|
||||
# replace --redis-host redis with the line below
|
||||
# - --start-redis
|
||||
|
||||
# Custom list of host devices that should be accessible to the container -
|
||||
# e.g. an Arduino, an ESP-compatible microcontroller, a joystick etc.
|
||||
# devices:
|
||||
# - /dev/ttyUSB0
|
||||
|
||||
# Uncomment if you need plugins that require access to low-level hardware
|
||||
# (e.g. Bluetooth BLE or GPIO/SPI/I2C) if access to individual devices is
|
||||
# not enough or isn't practical
|
||||
# privileged: true
|
||||
|
||||
# Copy .env.example to .env and modify as needed
|
||||
# env_file:
|
||||
# - .env
|
||||
|
@ -40,7 +44,13 @@ services:
|
|||
# expose it
|
||||
- "8008:8008"
|
||||
|
||||
volumes:
|
||||
- /path/to/your/config.yaml:/etc/platypush
|
||||
- /path/to/a/workdir:/var/lib/platypush
|
||||
# volumes:
|
||||
# Replace with a path that contains/will contain your config.yaml file
|
||||
# - /path/to/your/config:/etc/platypush
|
||||
# Replace with a path that contains/will contain your working directory
|
||||
# - /path/to/a/workdir:/var/lib/platypush
|
||||
# Optionally, use an external volume for the cache
|
||||
# - /path/to/a/cachedir:/var/cache/platypush
|
||||
|
||||
redis:
|
||||
image: redis
|
||||
|
|
|
@ -7,7 +7,7 @@ WORKDIR /var/lib/platypush
|
|||
RUN --mount=type=bind,source=.,target=/curdir \
|
||||
apk update && \
|
||||
# If the current directory is the Platypush repository, then we can copy the existing files \
|
||||
if grep 'name="platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
if grep -E 'name\s*=\s*"platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
then \
|
||||
cp -r /curdir /install; \
|
||||
# Otherwise, we need to clone the repository \
|
||||
|
@ -18,10 +18,9 @@ RUN --mount=type=bind,source=.,target=/curdir \
|
|||
|
||||
RUN /install/platypush/install/scripts/alpine/install.sh && \
|
||||
cd /install && \
|
||||
pip install -U --no-input --no-cache-dir . --break-system-packages && \
|
||||
pip install -U --no-input --no-cache-dir --no-deps . croniter --break-system-packages && \
|
||||
rm -rf /install && \
|
||||
rm -rf /root/.cache && \
|
||||
find / | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && \
|
||||
apk del gcc git && \
|
||||
apk cache clean && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
|
|
|
@ -10,7 +10,7 @@ ENV DOCKER_CTX=1
|
|||
RUN --mount=type=bind,source=.,target=/curdir \
|
||||
apt update && \
|
||||
# If the current directory is the Platypush repository, then we can copy the existing files \
|
||||
if grep 'name="platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
if grep -E 'name\s*=\s*"platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
then \
|
||||
cp -r /curdir /install; \
|
||||
# Otherwise, we need to clone the repository \
|
||||
|
@ -21,10 +21,9 @@ RUN --mount=type=bind,source=.,target=/curdir \
|
|||
|
||||
RUN /install/platypush/install/scripts/debian/install.sh && \
|
||||
cd /install && \
|
||||
pip install -U --no-input --no-cache-dir . --break-system-packages && \
|
||||
pip install -U --no-input --no-cache-dir --no-deps . --break-system-packages && \
|
||||
rm -rf /install && \
|
||||
rm -rf /root/.cache && \
|
||||
find / | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && \
|
||||
apt remove -y git build-essential && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
apt autoclean -y && \
|
||||
|
|
|
@ -7,20 +7,19 @@ ENV DOCKER_CTX=1
|
|||
|
||||
RUN --mount=type=bind,source=.,target=/curdir \
|
||||
# If the current directory is the Platypush repository, then we can copy the existing files \
|
||||
if grep 'name="platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
if grep -E 'name\s*=\s*"platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
then \
|
||||
cp -r /curdir /install; \
|
||||
# Otherwise, we need to clone the repository \
|
||||
else \
|
||||
dnf install -y git && \
|
||||
git clone https://github.com/blacklight/platypush.git /install; \
|
||||
fi
|
||||
fi; \
|
||||
dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
|
||||
# Enable the RPM Fusion repository
|
||||
RUN dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && \
|
||||
/install/platypush/install/scripts/fedora/install.sh && \
|
||||
RUN /install/platypush/install/scripts/fedora/install.sh && \
|
||||
cd /install && \
|
||||
pip install -U --no-input --no-cache-dir . --break-system-packages && \
|
||||
pip install -U --no-input --no-cache-dir --no-deps . --break-system-packages && \
|
||||
rm -rf /install && \
|
||||
rm -rf /root/.cache && \
|
||||
dnf remove -y build-essential git && \
|
||||
|
|
|
@ -10,7 +10,7 @@ ENV DOCKER_CTX=1
|
|||
RUN --mount=type=bind,source=.,target=/curdir \
|
||||
apt update && \
|
||||
# If the current directory is the Platypush repository, then we can copy the existing files \
|
||||
if grep 'name="platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
if grep -E 'name\s*=\s*"platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
|
||||
then \
|
||||
cp -r /curdir /install; \
|
||||
# Otherwise, we need to clone the repository \
|
||||
|
@ -21,12 +21,16 @@ RUN --mount=type=bind,source=.,target=/curdir \
|
|||
|
||||
RUN /install/platypush/install/scripts/debian/install.sh && \
|
||||
cd /install && \
|
||||
pip install -U --no-input --no-cache-dir . --break-system-packages && \
|
||||
pip install -U --no-input --no-cache-dir --no-deps . --break-system-packages && \
|
||||
rm -rf /install && \
|
||||
rm -rf /root/.cache && \
|
||||
find / | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && \
|
||||
apt remove -y git build-essential && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
apt remove -y git \
|
||||
build-essential \
|
||||
docutils-common \
|
||||
fonts-dejavu-mono \
|
||||
manpages \
|
||||
manpages-dev \
|
||||
python-babel-localedata && \
|
||||
apt autoclean -y && \
|
||||
apt autoremove -y && \
|
||||
apt clean && \
|
||||
|
|
Loading…
Reference in a new issue