FROM ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive \ DOTNET_CLI_TELEMETRY_OPTOUT=1 \ DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 \ DOTNET_NUGET_SIGNATURE_VERIFICATION=false \ NODE_OPTIONS="--max-old-space-size=4096" # 1. System packages + git + ClamAV + build tools RUN apt-get update && apt-get install -y \ curl wget gnupg ca-certificates apt-transport-https \ supervisor nginx unzip git \ clamav clamav-daemon clamav-freshclam \ build-essential \ && rm -rf /var/lib/apt/lists/* # 2. MongoDB 4.4 RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - \ && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" \ > /etc/apt/sources.list.d/mongodb-org-4.4.list \ && apt-get update && apt-get install -y mongodb-org \ && rm -rf /var/lib/apt/lists/* # 3. Redis RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/* # 4. Consul RUN wget https://releases.hashicorp.com/consul/1.8.0/consul_1.8.0_linux_amd64.zip \ && unzip consul_1.8.0_linux_amd64.zip \ && mv consul /usr/local/bin/ \ && rm consul_1.8.0_linux_amd64.zip # 5. .NET 5 SDK ENV DOTNET_SDK_VERSION=5.0.408 RUN wget https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \ && mkdir -p /usr/share/dotnet \ && tar -xzf dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz -C /usr/share/dotnet \ && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \ && rm dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz ENV DOTNET_ROOT=/usr/share/dotnet # 6. Node.js 16 RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ && apt-get install -y nodejs \ && rm -rf /var/lib/apt/lists/* # 7. Clone repo WORKDIR /app RUN git clone https://github.com/Chronoss3/MalwareMultiScan.git . \ && echo "Repository cloned successfully" # 8. NuGet restore RUN dotnet restore MalwareMultiScan.sln --disable-parallel \ && echo "NuGet restore completed" # 9. Build .NET solution RUN dotnet build MalwareMultiScan.sln -c Release --no-restore -v minimal \ || (echo "BUILD FAILED. See above." && exit 1) # 10. Build the Nuxt.js UI (now with make/gcc available) WORKDIR /app/MalwareMultiScan.Ui RUN npm install --no-audit --no-fund --prefer-offline \ && npm run build \ && mkdir -p /var/www/html \ && cp -r dist/* /var/www/html/ \ && echo "UI build completed" # 11. Nginx config RUN echo 'server { \ listen 7860; \ server_name _; \ root /var/www/html; \ index index.html; \ location /api { \ proxy_pass http://localhost:5000; \ proxy_http_version 1.1; \ proxy_set_header Upgrade \$http_upgrade; \ proxy_set_header Connection "upgrade"; \ proxy_set_header Host \$host; \ proxy_cache_bypass \$http_upgrade; \ proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; \ proxy_set_header X-Forwarded-Proto \$scheme; \ } \ location / { \ try_files \$uri \$uri/ /index.html; \ } \ }' > /etc/nginx/sites-available/default # 12. API environment ENV MONGO_ADDRESS=localhost:27017 \ REDIS_ADDRESS=localhost:6379 \ CONSUL_ADDRESS=http://localhost:8500 \ FILE_SIZE_LIMIT=50 \ ASPNETCORE_URLS=http://+:5000 COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf EXPOSE 7860 CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]