Openyx commited on
Commit
c35f228
·
verified ·
1 Parent(s): b932c5a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -28
Dockerfile CHANGED
@@ -1,61 +1,69 @@
1
  FROM ubuntu:20.04
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive
 
 
 
 
4
 
5
- # System packages + nginx + supervisor + ClamAV
6
  RUN apt-get update && apt-get install -y \
7
  curl wget gnupg ca-certificates apt-transport-https \
8
- supervisor nginx \
9
  clamav clamav-daemon clamav-freshclam \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # MongoDB 4.4
13
  RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - \
14
  && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" \
15
  > /etc/apt/sources.list.d/mongodb-org-4.4.list \
16
  && apt-get update && apt-get install -y mongodb-org \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Redis
20
  RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/*
21
 
22
- # Consul 1.8
23
  RUN wget https://releases.hashicorp.com/consul/1.8.0/consul_1.8.0_linux_amd64.zip \
24
  && unzip consul_1.8.0_linux_amd64.zip \
25
  && mv consul /usr/local/bin/ \
26
  && rm consul_1.8.0_linux_amd64.zip
27
 
28
- # ---- .NET 5 SDK (manual installation from Microsoft archive) ----
29
- ENV DOTNET_SDK_VERSION=5.0.408
30
- RUN wget https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
31
  && mkdir -p /usr/share/dotnet \
32
- && tar -xzf dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz -C /usr/share/dotnet \
33
  && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
34
- && rm dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz
 
35
 
36
- # Node.js 14
37
- RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \
38
  && apt-get install -y nodejs \
39
  && rm -rf /var/lib/apt/lists/*
40
 
41
- # Clone repository and build (with explicit target framework to avoid ambiguity)
42
  WORKDIR /app
43
  RUN git clone https://github.com/Chronoss3/MalwareMultiScan.git . \
44
- && dotnet build -c Release -f net5.0 \
45
- && cd MalwareMultiScan.Ui \
46
- && npm install \
 
 
 
 
 
 
 
 
 
 
47
  && npm run build \
48
  && mkdir -p /var/www/html \
49
- && cp -r dist/* /var/www/html/
50
-
51
- # API environment
52
- ENV MONGO_ADDRESS=localhost:27017 \
53
- REDIS_ADDRESS=localhost:6379 \
54
- CONSUL_ADDRESS=http://localhost:8500 \
55
- FILE_SIZE_LIMIT=50 \
56
- ASPNETCORE_URLS=http://+:5000
57
 
58
- # Nginx: serve UI + proxy API calls
59
  RUN echo 'server { \
60
  listen 7860; \
61
  server_name _; \
@@ -76,8 +84,13 @@ RUN echo 'server { \
76
  } \
77
  }' > /etc/nginx/sites-available/default
78
 
79
- # Supervisor config (same as before)
80
- COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 
 
 
 
81
 
 
82
  EXPOSE 7860
83
  CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
 
1
  FROM ubuntu:20.04
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ DOTNET_CLI_TELEMETRY_OPTOUT=1 \
5
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 \
6
+ DOTNET_NUGET_SIGNATURE_VERIFICATION=false \
7
+ NODE_OPTIONS="--max-old-space-size=4096"
8
 
9
+ # 1. Install system packages + ClamAV
10
  RUN apt-get update && apt-get install -y \
11
  curl wget gnupg ca-certificates apt-transport-https \
12
+ supervisor nginx unzip \
13
  clamav clamav-daemon clamav-freshclam \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # 2. MongoDB 4.4
17
  RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - \
18
  && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" \
19
  > /etc/apt/sources.list.d/mongodb-org-4.4.list \
20
  && apt-get update && apt-get install -y mongodb-org \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # 3. Redis
24
  RUN apt-get update && apt-get install -y redis-server && rm -rf /var/lib/apt/lists/*
25
 
26
+ # 4. Consul
27
  RUN wget https://releases.hashicorp.com/consul/1.8.0/consul_1.8.0_linux_amd64.zip \
28
  && unzip consul_1.8.0_linux_amd64.zip \
29
  && mv consul /usr/local/bin/ \
30
  && rm consul_1.8.0_linux_amd64.zip
31
 
32
+ # 5. .NET 5 SDK (from archive)
33
+ RUN wget https://dotnetcli.azureedge.net/dotnet/Sdk/5.0.408/dotnet-sdk-5.0.408-linux-x64.tar.gz \
 
34
  && mkdir -p /usr/share/dotnet \
35
+ && tar -xzf dotnet-sdk-5.0.408-linux-x64.tar.gz -C /usr/share/dotnet \
36
  && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
37
+ && rm dotnet-sdk-5.0.408-linux-x64.tar.gz
38
+ ENV DOTNET_ROOT=/usr/share/dotnet
39
 
40
+ # 6. Node.js 16 (more stable for Nuxt 2)
41
+ RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
42
  && apt-get install -y nodejs \
43
  && rm -rf /var/lib/apt/lists/*
44
 
45
+ # 7. Clone repo
46
  WORKDIR /app
47
  RUN git clone https://github.com/Chronoss3/MalwareMultiScan.git . \
48
+ && echo "Repository cloned successfully"
49
+
50
+ # 8. NuGet restore (separate step to see restore logs)
51
+ RUN dotnet restore MalwareMultiScan.sln --disable-parallel \
52
+ && echo "NuGet restore completed"
53
+
54
+ # 9. Build .NET solution (with explicit output to diagnose failure)
55
+ RUN dotnet build MalwareMultiScan.sln -c Release --no-restore -v minimal \
56
+ || (echo "BUILD FAILED. See above." && exit 1)
57
+
58
+ # 10. Build the Nuxt.js UI (separate step, with increased Node memory)
59
+ WORKDIR /app/MalwareMultiScan.Ui
60
+ RUN npm install --no-audit --no-fund --prefer-offline \
61
  && npm run build \
62
  && mkdir -p /var/www/html \
63
+ && cp -r dist/* /var/www/html/ \
64
+ && echo "UI build completed"
 
 
 
 
 
 
65
 
66
+ # 11. Configure nginx (port 7860 + API proxy)
67
  RUN echo 'server { \
68
  listen 7860; \
69
  server_name _; \
 
84
  } \
85
  }' > /etc/nginx/sites-available/default
86
 
87
+ # 12. Setup environment for API
88
+ ENV MONGO_ADDRESS=localhost:27017 \
89
+ REDIS_ADDRESS=localhost:6379 \
90
+ CONSUL_ADDRESS=http://localhost:8500 \
91
+ FILE_SIZE_LIMIT=50 \
92
+ ASPNETCORE_URLS=http://+:5000
93
 
94
+ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
95
  EXPOSE 7860
96
  CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]