haaaaus commited on
Commit
a9abc2a
·
verified ·
1 Parent(s): a40e3da

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -7
Dockerfile CHANGED
@@ -5,12 +5,12 @@ RUN apt-get update \
5
  && apt-get install -y wget libarchive-tools \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
- # Tạo non-root user theo khuyến nghị
9
  RUN useradd -m -u 1000 appuser
10
 
11
  WORKDIR /app
12
 
13
- # Tải TinfoilWebServer bản linux-x64 (framework-dependent)
14
  ARG ZIP_URL="https://github.com/Myster-Tee/TinfoilWebServer/releases/download/v2.1.0/TinfoilWebServer_v2.1.0_Framework-Dependent-linux-x64.zip"
15
  RUN wget -O /tmp/tws.zip "$ZIP_URL" \
16
  && bsdtar -xf /tmp/tws.zip -C /app \
@@ -19,19 +19,20 @@ RUN wget -O /tmp/tws.zip "$ZIP_URL" \
19
  && if [ -n "$subdir" ]; then cp -a "$subdir"/. /app/ && rm -rf "$subdir"; fi \
20
  && if [ -f /app/TinfoilWebServer ]; then chmod +x /app/TinfoilWebServer; fi
21
 
22
- # Copy cấu hình & custom index (đặt cạnh nhau)
23
  COPY TinfoilWebServer.config.json /app/TinfoilWebServer.config.json
24
  COPY index.json /app/index.json
25
 
26
- # Entry point: chuẩn bị /data rồi chạy app dưới appuser
27
  COPY entrypoint.sh /app/entrypoint.sh
28
  RUN chmod +x /app/entrypoint.sh
29
 
30
- # Quyền cho /app
31
  RUN chown -R appuser:appuser /app
32
 
33
- # Không đặt USER appuser ở đây để entrypoint có thể chown /data (cần root)
34
- # USER appuser <-- bỏ
 
35
 
36
  # Khai báo volume & cổng
37
  VOLUME ["/data"]
 
5
  && apt-get install -y wget libarchive-tools \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
+ # Tạo user non-root theo khuyến nghị (UID 1000)
9
  RUN useradd -m -u 1000 appuser
10
 
11
  WORKDIR /app
12
 
13
+ # Tải binary TinfoilWebServer (linux-x64, framework-dependent)
14
  ARG ZIP_URL="https://github.com/Myster-Tee/TinfoilWebServer/releases/download/v2.1.0/TinfoilWebServer_v2.1.0_Framework-Dependent-linux-x64.zip"
15
  RUN wget -O /tmp/tws.zip "$ZIP_URL" \
16
  && bsdtar -xf /tmp/tws.zip -C /app \
 
19
  && if [ -n "$subdir" ]; then cp -a "$subdir"/. /app/ && rm -rf "$subdir"; fi \
20
  && if [ -f /app/TinfoilWebServer ]; then chmod +x /app/TinfoilWebServer; fi
21
 
22
+ # Copy cấu hình & index (đặt cạnh nhau như bạn yêu cầu)
23
  COPY TinfoilWebServer.config.json /app/TinfoilWebServer.config.json
24
  COPY index.json /app/index.json
25
 
26
+ # Copy entrypoint & cấp quyền
27
  COPY entrypoint.sh /app/entrypoint.sh
28
  RUN chmod +x /app/entrypoint.sh
29
 
30
+ # Quyền sở hữu cho appuser
31
  RUN chown -R appuser:appuser /app
32
 
33
+ # Chạy dưới appuser (UID 1000)
34
+ USER appuser
35
+ ENV HOME=/home/appuser
36
 
37
  # Khai báo volume & cổng
38
  VOLUME ["/data"]