abcd118q commited on
Commit
c9197f5
·
verified ·
1 Parent(s): 50b2491

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -28
Dockerfile CHANGED
@@ -1,47 +1,42 @@
 
1
  FROM 1dev/server:latest
2
 
3
- # 1. Clear the entrypoint to stop the boot-loop
4
  ENTRYPOINT []
5
 
6
- # 2. Ports and Memory for your 16GB machine
7
  ENV ONEDEV_HTTP_PORT=7860
8
  ENV ONEDEV_SSH_PORT=7861
9
- # Tell Java to use the extra RAM you have
10
- ENV WRAPPER_MAX_MEMORY=12288
11
 
12
- # 3. Work from the absolute server root
13
  USER root
14
- WORKDIR /app
15
 
16
  EXPOSE 7860
17
 
18
- # 4. THE NO-GUESING BOOT SCRIPT
19
  CMD ["/bin/sh", "-c", " \
20
- echo '--- 2027 OneDev Server Force-Boot ---'; \
21
- \
22
- # 1. Define the actual paths (Force server, ignore agent) \
23
- SERVER_ROOT='/app'; \
24
- if [ ! -f \"$SERVER_ROOT/bin/server.sh\" ]; then SERVER_ROOT='/opt/onedev'; fi; \
25
- echo 'Verified Server Root at: ' $SERVER_ROOT; \
26
  \
27
- # 2. Prepare the persistent /data volume \
28
- mkdir -p /data/conf; \
29
- \
30
- # 3. Seed /data only if the config is missing \
31
- if [ ! -f /data/conf/server.properties ]; then \
32
- echo 'First boot: Initializing data volume...'; \
33
- cp -r $SERVER_ROOT/site/* /data/ 2>/dev/null || cp -r $SERVER_ROOT/conf /data/ 2>/dev/null || echo 'Manual seed required'; \
34
  fi; \
35
  \
36
- # 4. FORCE PORT 7860 (Hugging Face requirement) \
37
- # We check multiple possible config locations \
38
- echo 'Patching port to 7860...'; \
39
  find /data -name server.properties -exec sed -i 's/http_port.*/http_port=7860/g' {} +; \
40
  \
41
- # 5. Set Permissions \
 
42
  chmod -R 777 /data; \
43
  \
44
- # 6. Point OneDev to the volume and Launch \
45
- export ONEDEV_DATA_DIR=/data; \
46
- echo 'Launching OneDev... Please wait 2 minutes for the UI.'; \
47
- exec /bin/sh $SERVER_ROOT/bin/server.sh console"]
 
 
 
 
1
+
2
  FROM 1dev/server:latest
3
 
4
+ # 1. Kill the default entrypoint
5
  ENTRYPOINT []
6
 
7
+ # 2. Port and Memory Overrides for 16GB
8
  ENV ONEDEV_HTTP_PORT=7860
9
  ENV ONEDEV_SSH_PORT=7861
10
+ # Allocate 10GB to Java, leaving 6GB for the OS/Git
11
+ ENV WRAPPER_MAX_MEMORY=10240
12
 
 
13
  USER root
14
+ WORKDIR /data
15
 
16
  EXPOSE 7860
17
 
18
+ # 3. THE FAIL-PROOF EXECUTION ENGINE
19
  CMD ["/bin/sh", "-c", " \
20
+ echo '--- 2027 OneDev Ultimate Boot Sequence ---'; \
 
 
 
 
 
21
  \
22
+ # 1. Check if we have already moved the server to persistent storage \
23
+ if [ ! -f /data/bin/server.sh ]; then \
24
+ echo 'First time setup: Migrating OneDev to persistent storage...'; \
25
+ cp -r /app/* /data/ || cp -r /opt/onedev/* /data/; \
 
 
 
26
  fi; \
27
  \
28
+ # 2. Force the port into the config file \
29
+ echo 'Enforcing port 7860...'; \
 
30
  find /data -name server.properties -exec sed -i 's/http_port.*/http_port=7860/g' {} +; \
31
  \
32
+ # 3. Nuclear permission fix - ensuring the wrapper can execute \
33
+ echo 'Setting permissions...'; \
34
  chmod -R 777 /data; \
35
  \
36
+ # 4. CRITICAL: Change directory to the binary folder before executing \
37
+ # This ensures the Java Wrapper finds its relative config files. \
38
+ cd /data/bin; \
39
+ \
40
+ echo 'Starting OneDev Engine...'; \
41
+ # We use 'exec' so Java becomes PID 1 and logs stream directly to HF \
42
+ exec ./server.sh console"]