File size: 1,573 Bytes
88c2c5d
3d99e94
18150f0
3d379eb
 
18150f0
3d99e94
049e050
18150f0
 
 
2541165
3d99e94
 
2541165
896aad3
3d99e94
 
18150f0
2a99d80
18150f0
99ba3ba
18150f0
 
 
 
2541165
18150f0
 
 
 
 
 
 
 
 
 
 
 
3d379eb
18150f0
2541165
18150f0
1e50e50
18150f0
97cae39
18150f0
97cae39
18150f0
 
 
c9197f5
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
43
44
45
46
47
48
49
50
51
52
FROM 1dev/server:latest

# 1. Reset Entrypoint
ENTRYPOINT []

# 2. Set Hugging Face Ports
ENV ONEDEV_HTTP_PORT=7860
ENV ONEDEV_SSH_PORT=7861

# 3. Optimize for 16GB RAM
# We give Java 12GB, leaving 4GB for the system
ENV WRAPPER_MAX_MEMORY=12288

USER root
WORKDIR /app

EXPOSE 7860

# 4. THE SYMLINK ENGINE
CMD ["/bin/sh", "-c", " \
    echo '--- 2027 OneDev Symlink Boot Sequence ---'; \
    \
    # 1. Identify the real installation folder \
    INSTALL_DIR='/app'; \
    if [ ! -d /app/bin ]; then INSTALL_DIR='/opt/onedev'; fi; \
    echo 'Installation found at: '$INSTALL_DIR; \
    \
    # 2. For each data folder, move to /data and symlink it back \
    # This keeps the app structure 'standard' while persisting data \
    for dir in conf db logs storage; do \
        if [ ! -d /data/$dir ]; then \
            echo 'Initializing persistent '$dir'...'; \
            mkdir -p /data/$dir; \
            cp -r $INSTALL_DIR/$dir/* /data/$dir/ 2>/dev/null || true; \
        fi; \
        # Replace the local folder with a link to the persistent one \
        rm -rf $INSTALL_DIR/$dir; \
        ln -s /data/$dir $INSTALL_DIR/$dir; \
    done; \
    \
    # 3. Force the port in the persistent config \
    echo 'Patching port to 7860...'; \
    sed -i 's/http_port.*/http_port=7860/g' /data/conf/server.properties; \
    \
    # 4. Final permissions fix \
    chmod -R 777 /data; \
    chmod -R 777 $INSTALL_DIR; \
    \
    # 5. Launch with direct stdout visibility \
    echo 'Starting OneDev Engine...'; \
    cd $INSTALL_DIR/bin; \
    exec ./server.sh console"]