File size: 1,348 Bytes
b3408b4
b74e9f2
b3408b4
178ea20
 
 
b3408b4
a9abc2a
666f683
 
b3408b4
 
a9abc2a
b74e9f2
 
178ea20
a5be546
 
 
 
b3408b4
a9abc2a
b74e9f2
816e4f2
b3408b4
a9abc2a
ac440d8
 
 
a9abc2a
666f683
8ca8ba5
a9abc2a
 
 
666f683
ac440d8
666f683
b3408b4
 
ac440d8
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
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/aspnet:8.0

RUN apt-get update \
 && apt-get install -y wget libarchive-tools \
 && rm -rf /var/lib/apt/lists/*

# Tạo user non-root theo khuyến nghị (UID 1000)
RUN useradd -m -u 1000 appuser

WORKDIR /app

# Tải binary TinfoilWebServer (linux-x64, framework-dependent)
ARG ZIP_URL="https://github.com/Myster-Tee/TinfoilWebServer/releases/download/v2.1.0/TinfoilWebServer_v2.1.0_Framework-Dependent-linux-x64.zip"
RUN wget -O /tmp/tws.zip "$ZIP_URL" \
 && bsdtar -xf /tmp/tws.zip -C /app \
 && rm -f /tmp/tws.zip \
 && subdir="$(find /app -mindepth 1 -maxdepth 1 -type d -name 'TinfoilWebServer*linux-x64' | head -n1)" \
 && if [ -n "$subdir" ]; then cp -a "$subdir"/. /app/ && rm -rf "$subdir"; fi \
 && if [ -f /app/TinfoilWebServer ]; then chmod +x /app/TinfoilWebServer; fi

# Copy cấu hình & index (đặt cạnh nhau như bạn yêu cầu)
COPY TinfoilWebServer.config.json /app/TinfoilWebServer.config.json
COPY index.json /app/index.json

# Copy entrypoint & cấp quyền
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# Quyền sở hữu cho appuser
RUN chown -R appuser:appuser /app

# Chạy dưới appuser (UID 1000)
USER appuser
ENV HOME=/home/appuser

# Khai báo volume & cổng
VOLUME ["/data"]
EXPOSE 5000

CMD ["/app/entrypoint.sh"]