nicholaslewishub5884 commited on
Commit
672da1d
·
verified ·
1 Parent(s): 6556716

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -0
Dockerfile CHANGED
@@ -17,6 +17,31 @@ RUN apt-get update && apt-get install -y \
17
  libsqlite3-dev \
18
  && rm -rf /var/lib/apt/lists/*
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  # cho node dùng sudo không password
21
  RUN echo "node ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
22
 
 
17
  libsqlite3-dev \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
+
21
+ # Sử dụng Stage trung gian để xử lý cấu hình mạng
22
+ FROM alpine:latest AS network-fixer
23
+ ARG DNS_SERVER=8.8.8.8
24
+ RUN echo "nameserver ${DNS_SERVER}" > /etc/resolv.conf
25
+
26
+ # Stage chính để build ứng dụng
27
+ FROM ubuntu:22.04
28
+
29
+ # Copy cấu hình DNS từ stage trên vào (nếu hệ thống cho phép)
30
+ COPY --from=network-fixer /etc/resolv.conf /etc/resolv.conf || true
31
+
32
+ # Kết hợp: Vô hiệu hóa Proxy APT + Ép dùng IPv4 để tránh lỗi treo mạng
33
+ RUN echo 'Acquire::http::Proxy "false";' > /etc/apt/apt.conf.d/99proxy && \
34
+ apt-get update -o Acquire::ForceIPv4=true && \
35
+ apt-get install -y --no-install-recommends \
36
+ curl \
37
+ ca-certificates \
38
+ && rm -rf /var/lib/apt/lists/*
39
+
40
+ # Các bước cài đặt tiếp theo của bạn...
41
+
42
+
43
+
44
+
45
  # cho node dùng sudo không password
46
  RUN echo "node ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
47