eienmojiki commited on
Commit
b445b42
·
verified ·
1 Parent(s): 32df9e7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -1,8 +1,9 @@
1
- # Sử dụng Node.js LTS làm base image
2
- FROM node:lts
3
 
4
  # --- Cài đặt PostgreSQL và các công cụ cần thiết ---
5
- RUN apt-get update && apt-get install -y postgresql postgresql-contrib git sudo
 
6
 
7
  # --- Cấu hình người dùng Postgres ---
8
  RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql
@@ -16,14 +17,14 @@ RUN git clone https://github.com/nocobase/nocobase.git -b main --depth=1 my-noco
16
 
17
  # --- Cài đặt Dependencies ---
18
  WORKDIR /app/my-nocobase
19
- RUN yarn install --frozen-lockfile
 
20
 
21
  # --- Build NocoBase và khởi tạo Database ---
22
  RUN /etc/init.d/postgresql start && \
23
  until su - postgres -c "pg_isready"; do sleep 1; done && \
24
  su - postgres -c "psql -c \"CREATE USER nocobase_user WITH PASSWORD 'nocobase_password';\"" && \
25
  su - postgres -c "psql -c \"CREATE DATABASE nocobase_db OWNER nocobase_user;\"" && \
26
- # --- THÊM DB_DIALECT VÀO ĐÂY ---
27
  export DB_DIALECT="postgres" && \
28
  export APP_KEY="temporary-build-key" && \
29
  export DB_HOST="localhost" && \
@@ -32,6 +33,8 @@ RUN /etc/init.d/postgresql start && \
32
  export DB_USER="nocobase_user" && \
33
  export DB_PASSWORD="nocobase_password" && \
34
  export TZ="UTC" && \
 
 
35
  yarn nocobase install --lang=en-US && \
36
  /etc/init.d/postgresql stop
37
 
 
1
+ # Sử dụng Node.js 18 trên nền Debian Buster (ổn định hơn)
2
+ FROM node:18-buster
3
 
4
  # --- Cài đặt PostgreSQL và các công cụ cần thiết ---
5
+ # Thêm gnupg2 để đảm bảo key hoạt động đúng nếu cần
6
+ RUN apt-get update && apt-get install -y postgresql postgresql-contrib git sudo gnupg2
7
 
8
  # --- Cấu hình người dùng Postgres ---
9
  RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql
 
17
 
18
  # --- Cài đặt Dependencies ---
19
  WORKDIR /app/my-nocobase
20
+ # Thêm cờ --network-timeout để tránh lỗi mạng khi cài đặt nhiều gói
21
+ RUN yarn install --frozen-lockfile --network-timeout 100000
22
 
23
  # --- Build NocoBase và khởi tạo Database ---
24
  RUN /etc/init.d/postgresql start && \
25
  until su - postgres -c "pg_isready"; do sleep 1; done && \
26
  su - postgres -c "psql -c \"CREATE USER nocobase_user WITH PASSWORD 'nocobase_password';\"" && \
27
  su - postgres -c "psql -c \"CREATE DATABASE nocobase_db OWNER nocobase_user;\"" && \
 
28
  export DB_DIALECT="postgres" && \
29
  export APP_KEY="temporary-build-key" && \
30
  export DB_HOST="localhost" && \
 
33
  export DB_USER="nocobase_user" && \
34
  export DB_PASSWORD="nocobase_password" && \
35
  export TZ="UTC" && \
36
+ # Thêm NODE_OPTIONS để hỗ trợ các thuật toán mã hóa cũ nếu cần
37
+ export NODE_OPTIONS=--openssl-legacy-provider && \
38
  yarn nocobase install --lang=en-US && \
39
  /etc/init.d/postgresql stop
40