Sign inSign up

galihridhoutomo/malware-detector

By galihridhoutomo

Updated about 1 year ago

AI-powered malware detection library with neural network implementation for C++.

Image
Security
Languages & frameworks
Machine learning & AI
0

10K+

galihridhoutomo/malware-detector repository overview

🐳 Docker Deployment Guide

This guide explains how to build, run, and deploy the Malware Detector Library using Docker containers.

📋 Quick Start

Prerequisites
  • Docker Engine 20.10+
  • Docker Compose 2.0+
  • Git
🚀 Run with Docker
# Pull and run the latest image
docker run -p 80:80 -p 3000:3000 ghcr.io/galihru/malware-detector-cpp:latest

# Or use docker-compose
docker-compose up -d

Access the application at:

🛠 Building from Source

Build the Image
# Build with default settings
docker build -t malware-detector .

# Build with specific version
docker build --build-arg VERSION=1.2.3 -t malware-detector:1.2.3 .

# Build using the build script
chmod +x docker/build.sh
./docker/build.sh build
Test the Image
# Test the built image
./docker/build.sh test

# Or manually test
docker run -d -p 8080:80 --name test-container malware-detector
curl http://localhost:8080/
docker stop test-container && docker rm test-container

🔧 Development Setup

Development Environment
# Start development environment
docker-compose -f docker-compose.dev.yml up --build

# With file watching
docker-compose -f docker-compose.dev.yml up --build file-watcher
Environment Variables
VariableDefaultDescription
NODE_ENVproductionEnvironment mode
API_PORT3000API server port
WEB_PORT80Web server port
UPLOAD_MAX_SIZE100MBMaximum upload size
ENABLE_DEMOtrueEnable demo functionality
LOG_LEVELinfoLogging level
Volume Mounts
docker run -p 80:80 \
  -v $(pwd)/docs:/app/docs \
  -v $(pwd)/uploads:/app/uploads \
  -v $(pwd)/logs:/app/logs \
  -v $(pwd)/models:/app/models \
  malware-detector

📦 GitHub Container Registry

Login to GitHub Packages
# Create a personal access token with packages:read and packages:write scopes
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
Pull Images
# Latest version
docker pull ghcr.io/galihru/malware-detector-cpp:latest

# Specific version
docker pull ghcr.io/galihru/malware-detector-cpp:1.2.3

# List available tags
curl -s https://api.github.com/users/galihru/packages/container/malware-detector-cpp/versions | jq '.[].metadata.container.tags'
Push Images
# Tag for GitHub Packages
docker tag malware-detector ghcr.io/galihru/malware-detector-cpp:latest

# Push to registry
docker push ghcr.io/galihru/malware-detector-cpp:latest

# Or use the build script
./docker/build.sh push

🚀 Deployment

Production Deployment
# Production compose file
docker-compose -f docker-compose.yml up -d

# With custom configuration
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
Docker Swarm
# Initialize swarm
docker swarm init

# Deploy stack
docker stack deploy -c docker-compose.yml malware-detector

# Scale services
docker service scale malware-detector_malware-detector=3

🔍 Health Checks

Built-in Health Check

The container includes a health check that verifies:

  • Nginx is running
  • Web server is responding
  • Disk and memory usage
# Check health status
docker inspect --format='{{.State.Health.Status}}' CONTAINER_ID

# View health check logs
docker inspect --format='{{range .State.Health.Log}}{{.Output}}{{end}}' CONTAINER_ID
Custom Health Check
# Manual health check
docker exec CONTAINER_ID /app/docker/healthcheck.sh

📊 Monitoring

Container Stats
# Real-time stats
docker stats

# Container logs
docker-compose logs -f malware-detector

# Service-specific logs
docker-compose logs -f malware-detector nginx
Log Files
  • Application: /app/logs/
  • Nginx: /var/log/nginx/
  • Supervisor: /var/log/supervisor/

🔧 Troubleshooting

Common Issues
  1. Port conflicts:

    # Use different ports
    docker run -p 8080:80 -p 3001:3000 malware-detector
    
  2. Permission issues:

    # Fix file permissions
    docker exec -it CONTAINER_ID chown -R www-data:www-data /app/docs
    
  3. Memory issues:

    # Increase memory limit
    docker run --memory=1g malware-detector
    
Debug Mode
# Run with debug environment
docker run -e LOG_LEVEL=debug -e NODE_ENV=development malware-detector

# Interactive shell
docker exec -it CONTAINER_ID /bin/bash

📋 Available Scripts

ScriptDescription
docker/build.shBuild and test Docker images
docker/healthcheck.shContainer health verification
docker/entrypoint.shContainer initialization

📄 License

MIT License - see LICENSE file for details.

Tag summary

Content type

Image

Digest

sha256:4770508b0

Size

325.6 MB

Last updated

about 1 year ago

docker pull galihridhoutomo/malware-detector