From a9c38cf529fcd8af88ee180663788cd3d089a578 Mon Sep 17 00:00:00 2001 From: walle Date: Wed, 19 Nov 2025 17:38:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E5=92=8C=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 Dockerfile.dev-server 的 NODE_ENV 设置为 development - 更改 docker-compose.yml 端口映射为 11081:8080 避免端口冲突 - 添加容器启动命令确保安装必要的开发依赖 - 解决 astro 构建时的依赖问题 这些修改确保开发环境能够正常启动和运行, 同时避免与主机上的其他服务端口冲突。 --- Dockerfile.dev-server | 4 ++-- docker-compose.yml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile.dev-server b/Dockerfile.dev-server index 35a23d2..933d659 100644 --- a/Dockerfile.dev-server +++ b/Dockerfile.dev-server @@ -11,7 +11,7 @@ RUN apk add --no-cache \ WORKDIR /app # 设置环境变量 -ENV NODE_ENV=production +ENV NODE_ENV=development ENV PORT=8080 ENV HOST=0.0.0.0 ENV PATH="/app/node_modules/.bin:${PATH}" @@ -53,4 +53,4 @@ LABEL maintainer="walllee" \ org.opencontainers.image.created="${BUILD_DATE}" \ org.opencontainers.image.revision="${VCS_REF}" \ org.opencontainers.image.source="https://github.com/wheesys/moodist" \ - org.opencontainers.image.licenses="MIT" \ No newline at end of file + org.opencontainers.image.licenses="MIT" diff --git a/docker-compose.yml b/docker-compose.yml index e3905cb..e81b37e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: max-size: 1g restart: unless-stopped ports: - - '8080:8080' + - '11081:8080' volumes: # 挂载源代码用于热重载(保持用户权限) - .:/app:cached @@ -19,6 +19,8 @@ services: - PORT=8080 stdin_open: true tty: true + # 启动时确保安装了必要的开发依赖 + command: sh -c "cd /app && npm install @astrojs/node autoprefixer --no-save && npm run dev -- --host 0.0.0.0 --port 8080" volumes: node_modules_volume: