| 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" |
|
|
| |
| 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/* |
|
|
| |
| 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/* |
|
|
| |
| RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/* |
|
|
| |
| 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 |
|
|
| |
| 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 |
|
|
| |
| RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ |
| && apt-get install -y nodejs \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| WORKDIR /app |
| RUN git clone https://github.com/Chronoss3/MalwareMultiScan.git . \ |
| && echo "Repository cloned successfully" |
|
|
| |
| RUN dotnet restore MalwareMultiScan.sln --disable-parallel \ |
| && echo "NuGet restore completed" |
|
|
| |
| RUN dotnet build MalwareMultiScan.sln -c Release --no-restore -v minimal \ |
| || (echo "BUILD FAILED. See above." && exit 1) |
|
|
| |
| 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" |
|
|
| |
| 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 |
|
|
| |
| 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"] |