victorgeek commited on
Commit
41f4c23
·
verified ·
1 Parent(s): 4b3d9d1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -7
Dockerfile CHANGED
@@ -1,12 +1,43 @@
1
- # ... (ယခင် commands များ) ...
 
2
 
3
- # --- ပြင်ဆင်ရန် ---
4
- # Expose the port Hugging Face expects (8080)
5
- # 80 မဟုတ်တော့ပါ <--- Comment ကို ဒီလို အပေါ်မှာထားပါ
6
- EXPOSE 8080 # <<< ဒီစာကြောင်းမှာ port number ပဲ ထားပါ
7
 
8
- # Switch to "ferron" user (AFTER ownership changes)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  USER ferron
10
 
11
- # Set the command to run the binary using the config file
12
  CMD ["/usr/sbin/ferron", "-c", "/etc/ferron.yaml"]
 
1
+ # ======== Stage 1: Build ========
2
+ FROM rust:latest as builder
3
 
4
+ WORKDIR /usr/src/ferron
 
 
 
5
 
6
+ # Copy source code (Requires full source in project root)
7
+ COPY . .
8
+
9
+ # Build the release binaries
10
+ RUN cargo build --release
11
+
12
+ # ======== Stage 2: Final Image ========
13
+ FROM devuan/devuan:latest
14
+
15
+ # Copy compiled binaries from 'builder' stage
16
+ COPY --from=builder /usr/src/ferron/target/release/ferron /usr/sbin/ferron
17
+ COPY --from=builder /usr/src/ferron/target/release/ferron-passwd /usr/sbin/ferron-passwd
18
+
19
+ # Copy the configuration file
20
+ # --- Local မှာ 'ferron-docker.yaml' file ရှိပြီး အောက်က content အမှန် ဖြစ်ရမည် ---
21
+ COPY ferron-docker.yaml /etc/ferron.yaml
22
+
23
+ # Create webroot directory and copy content
24
+ # --- Local မှာ 'wwwroot' directory နှင့် content ရှိရမည် ---
25
+ RUN mkdir -p /var/www/ferron
26
+ COPY wwwroot/* /var/www/ferron/
27
+
28
+ # Create log directory
29
+ RUN mkdir -p /var/log/ferron
30
+
31
+ # Create user and set permissions
32
+ RUN useradd -d /nonexistent -s /usr/sbin/nologin -r ferron && \
33
+ chown -R ferron:ferron /var/www/ferron && \
34
+ chown -R ferron:ferron /var/log/ferron
35
+
36
+ # Expose the correct port
37
+ EXPOSE 8080
38
+
39
+ # Switch to the non-root user
40
  USER ferron
41
 
42
+ # Set the runtime command
43
  CMD ["/usr/sbin/ferron", "-c", "/etc/ferron.yaml"]