File size: 3,474 Bytes
4254e65
b83e51d
c35f228
 
 
 
 
b83e51d
bea75d9
b83e51d
 
3af411d
24eacfd
bea75d9
b83e51d
 
c35f228
b83e51d
 
 
 
 
 
c35f228
b83e51d
 
c35f228
b83e51d
 
 
 
 
bea75d9
3af411d
 
b932c5a
3af411d
b932c5a
3af411d
c35f228
b83e51d
3af411d
c35f228
b83e51d
 
 
c35f228
b83e51d
 
c35f228
 
3af411d
c35f228
 
 
3af411d
c35f228
 
 
bea75d9
c35f228
 
b83e51d
 
c35f228
 
b83e51d
bea75d9
b83e51d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3af411d
c35f228
 
 
 
 
b83e51d
c35f228
b83e51d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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"]