feat: docker-compose 添加 volumes 映射和 SSH 登录自动进入 /app 目录
This commit is contained in:
@@ -18,6 +18,8 @@ services:
|
|||||||
- "${WEB_PORT:-5173}:${WEB_PORT:-5173}"
|
- "${WEB_PORT:-5173}:${WEB_PORT:-5173}"
|
||||||
- "${SERVER_PORT:-8000}:${SERVER_PORT:-8000}"
|
- "${SERVER_PORT:-8000}:${SERVER_PORT:-8000}"
|
||||||
- "2223:22"
|
- "2223:22"
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
@@ -27,8 +29,14 @@ services:
|
|||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends
|
||||||
python3 python3-pip python3-venv &&
|
python3 python3-pip python3-venv &&
|
||||||
mkdir -p /run/sshd && /usr/sbin/sshd &&
|
mkdir -p /run/sshd && /usr/sbin/sshd &&
|
||||||
|
printf '%s\n' 'cd /app >/dev/null 2>&1 || true' > /etc/profile.d/zz-x-financial-app-dir.sh &&
|
||||||
|
chmod 644 /etc/profile.d/zz-x-financial-app-dir.sh &&
|
||||||
|
touch /root/.bashrc /root/.profile &&
|
||||||
|
if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.bashrc; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.bashrc; fi &&
|
||||||
|
if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.profile; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.profile; fi &&
|
||||||
sed -i 's/\r$//' /app/start.sh /app/web/web_start.sh /app/server/server_start.sh &&
|
sed -i 's/\r$//' /app/start.sh /app/web/web_start.sh /app/server/server_start.sh &&
|
||||||
chmod +x /app/start.sh /app/web/web_start.sh /app/server/server_start.sh &&
|
chmod +x /app/start.sh /app/web/web_start.sh /app/server/server_start.sh &&
|
||||||
|
cd /app &&
|
||||||
./start.sh all
|
./start.sh all
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:${WEB_PORT:-5173}/ >/dev/null || exit 1"]
|
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:${WEB_PORT:-5173}/ >/dev/null || exit 1"]
|
||||||
|
|||||||
Reference in New Issue
Block a user