nzyme
nzyme copied to clipboard
Docker-compose version of nzyme
Docker-compose version of nzyme using host network mode to get access to wlan. Especially made to avoid dependency and installation issues. Uses an ubuntu based docker for Nzyme and a postgres docker for de data.
Thank you! I have made some optimizations to the docker-compose.yml by disabling privileged mode and adding capabilities plus a timezone environment variable for correct logging. Postgres also does not need to run in host network mode, instead the port can be fowarded to only listen on localhost.
docker-compose.yml
version: '3.8'
services:
nzyme:
build: .
restart: unless-stopped
#container_name: nzyme
env_file:
- .env
volumes:
- ./nzyme.conf:/etc/nzyme/nzyme.conf.tmp #copy in entrypoint
- ./logs:/var/log/nzyme/
#ports:
# - "22900:22900"
depends_on:
- db
environment:
- TZ=Europe/Berlin
- DATABASE_URL=$DATABASE_URL
- ADMIN_PASSWORD_HASH=$ADMIN_PASSWORD_HASH
- EXTERNAL_URL=$EXTERNAL_URL
network_mode: host
cap_add: # full access to wifi interface
- NET_ADMIN
- NET_RAW
db:
image: postgres:latest
restart: unless-stopped
environment:
- TZ=Europe/Berlin
- POSTGRES_DB=$POSTGRES_DB
- POSTGRES_USER=$POSTGRES_USER
- POSTGRES_PASSWORD=$POSTGRES_PASS
volumes:
- ./data:/var/lib/postgresql/data
ports:
- 127.0.0.1:5432:5432 # Since we use host net on nzyme, listen only locally
healthcheck:
test: ["CMD", "pg_isready", "-U", "$POSTGRES_USER"]
interval: 10s
start_period: 30s
Dockerfile - container size optimization
Optimized container size by consolidating layer operations, removing systemd
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y --no-install-recommends python3 libpcap0.8 openjdk-11-jre-headless wireless-tools gettext-base curl \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& export VERSION=`curl -s https://www.nzyme.org/blog/rss.xml | grep -E '[0-9]+\.[0-9]+\.[0-9]+' -o | head -n1` \
&& echo $VERSION && curl -s https://assets.nzyme.org/releases/nzyme-$VERSION.deb -o nzyme.deb \
&& dpkg -i nzyme.deb && rm nzyme.deb
# Entrypoint: Replace variables in config
COPY docker-entrypoint.sh /bin/
RUN chmod +x /usr/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
CMD /bin/bash /usr/share/nzyme/bin/nzyme
I'm sorry for the delay. I have modified the code with your suggestions and everything seems to work perfectly. Thank you very much @tadev.