| FROM 1dev/server:latest |
|
|
| |
| ENTRYPOINT [] |
|
|
| |
| ENV ONEDEV_HTTP_PORT=7860 |
| ENV ONEDEV_SSH_PORT=7861 |
|
|
| |
| |
| ENV WRAPPER_MAX_MEMORY=12288 |
|
|
| USER root |
| WORKDIR /app |
|
|
| EXPOSE 7860 |
|
|
| |
| 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"] |