Files
bzzz/deployments/dockerized-BZZZ/Dockerfile
anthonyrawlins f5f96ba505 Major updates and improvements to BZZZ system
- Updated configuration and deployment files
- Improved system architecture and components
- Enhanced documentation and testing
- Fixed various issues and added new features

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 18:06:57 +10:00

72 lines
1.9 KiB
Docker

FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates tzdata curl locales gettext-base systemd systemd-sysv && \
rm -rf /var/lib/apt/lists/*
# Configure systemd for container use
RUN cd /lib/systemd/system/sysinit.target.wants/ && \
ls | grep -v systemd-tmpfiles-setup | xargs rm -f && \
rm -f /lib/systemd/system/multi-user.target.wants/* && \
rm -f /etc/systemd/system/*.wants/* && \
rm -f /lib/systemd/system/local-fs.target.wants/* && \
rm -f /lib/systemd/system/sockets.target.wants/*udev* && \
rm -f /lib/systemd/system/sockets.target.wants/*initctl* && \
rm -f /lib/systemd/system/basic.target.wants/* && \
rm -f /lib/systemd/system/anaconda.target.wants/*
# Create bzzz directories
RUN mkdir -p /opt/bzzz /opt/bzzz/.bzzz /etc/systemd/system
# BZZZ binary
COPY ./build/bzzz /opt/bzzz/bzzz
RUN chmod +x /opt/bzzz/bzzz
# Config template
COPY ./config.yml.tmpl /opt/bzzz/.bzzz/config.yml.tmpl
# Create systemd service file
RUN cat > /etc/systemd/system/bzzz.service << 'EOF'
[Unit]
Description=BZZZ P2P Task Coordination System
After=network.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/bzzz
ExecStart=/opt/bzzz/bzzz -config /opt/bzzz/.bzzz/config.yml
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=bzzz
[Install]
WantedBy=multi-user.target
EOF
# Enable the service
RUN systemctl enable bzzz.service
# Create startup script that renders config and starts systemd
RUN cat > /opt/bzzz/startup.sh << 'EOF'
#!/bin/bash
set -e
# Render config from template
envsubst < /opt/bzzz/.bzzz/config.yml.tmpl > /opt/bzzz/.bzzz/config.yml
# Start systemd
exec /lib/systemd/systemd
EOF
RUN chmod +x /opt/bzzz/startup.sh
# Working directory
WORKDIR /opt/bzzz
# Use systemd as init system
ENTRYPOINT ["/opt/bzzz/startup.sh"]