abcd118q commited on
Commit
2541165
·
verified ·
1 Parent(s): 677a977

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -21
Dockerfile CHANGED
@@ -1,41 +1,44 @@
1
  FROM 1dev/server:latest
2
 
3
- # 1. Kill the default entrypoint
4
  ENTRYPOINT []
5
 
6
- # 2. Port and Memory Overrides for 16GB
7
  ENV ONEDEV_HTTP_PORT=7860
8
  ENV ONEDEV_SSH_PORT=7861
9
- # Allocate 10GB to Java, leaving 6GB for the OS/Git
10
- ENV WRAPPER_MAX_MEMORY=10240
11
 
12
  USER root
13
- WORKDIR /data
 
14
 
15
  EXPOSE 7860
16
 
17
- # 3. THE FAIL-PROOF EXECUTION ENGINE
18
  CMD ["/bin/sh", "-c", " \
19
- echo '--- 2027 OneDev Ultimate Boot Sequence ---'; \
20
  \
21
- # 1. Check if we have already moved the server to persistent storage \
22
- if [ ! -f /data/bin/server.sh ]; then \
23
- echo 'First time setup: Migrating OneDev to persistent storage...'; \
24
- cp -r /app/* /data/ || cp -r /opt/onedev/* /data/; \
 
 
 
 
25
  fi; \
26
  \
27
- # 2. Force the port into the config file \
28
- echo 'Enforcing port 7860...'; \
29
- find /data -name server.properties -exec sed -i 's/http_port.*/http_port=7860/g' {} +; \
30
  \
31
- # 3. Nuclear permission fix - ensuring the wrapper can execute \
32
- echo 'Setting permissions...'; \
33
  chmod -R 777 /data; \
34
  \
35
- # 4. CRITICAL: Change directory to the binary folder before executing \
36
- # This ensures the Java Wrapper finds its relative config files. \
37
- cd /data/bin; \
38
  \
39
- echo 'Starting OneDev Engine...'; \
40
- # We use 'exec' so Java becomes PID 1 and logs stream directly to HF \
41
  exec ./server.sh console"]
 
1
  FROM 1dev/server:latest
2
 
3
+ # 1. Clear entrypoint
4
  ENTRYPOINT []
5
 
6
+ # 2. 16GB RAM Optimization
7
  ENV ONEDEV_HTTP_PORT=7860
8
  ENV ONEDEV_SSH_PORT=7861
9
+ ENV WRAPPER_MAX_MEMORY=12288
 
10
 
11
  USER root
12
+ # We stay in the original app directory to keep the classpath intact
13
+ WORKDIR /app
14
 
15
  EXPOSE 7860
16
 
17
+ # 3. THE HYBRID BOOT SCRIPT
18
  CMD ["/bin/sh", "-c", " \
19
+ echo '--- 2027 OneDev Hybrid Boot Sequence ---'; \
20
  \
21
+ # 1. Prepare the persistent volume structure \
22
+ mkdir -p /data/conf; \
23
+ \
24
+ # 2. Seed only the configuration files if they are missing \
25
+ # We do NOT move the binaries (to avoid NoClassDefFoundError) \
26
+ if [ ! -f /data/conf/server.properties ]; then \
27
+ echo 'First run: Initializing persistent configuration...'; \
28
+ cp -r /app/conf/* /data/conf/ 2>/dev/null || cp -r /app/site/conf/* /data/conf/; \
29
  fi; \
30
  \
31
+ # 3. Force port 7860 in the persistent config \
32
+ echo 'Patching port to 7860...'; \
33
+ find /data/conf -name server.properties -exec sed -i 's/http_port.*/http_port=7860/g' {} +; \
34
  \
35
+ # 4. Permissions check \
 
36
  chmod -R 777 /data; \
37
  \
38
+ # 5. THE MAGIC KEY: Point OneDev to use /data for storage \
39
+ # This keeps the JAR files in /app but saves your work in /data \
40
+ export ONEDEV_DATA_DIR=/data; \
41
  \
42
+ echo 'Launching OneDev Server...'; \
43
+ cd /app/bin; \
44
  exec ./server.sh console"]