feat: 优化开发环境配置和端口映射

- 修复 Dockerfile.dev-server 的 NODE_ENV 设置为 development
- 更改 docker-compose.yml 端口映射为 11081:8080 避免端口冲突
- 添加容器启动命令确保安装必要的开发依赖
- 解决 astro 构建时的依赖问题

这些修改确保开发环境能够正常启动和运行,
同时避免与主机上的其他服务端口冲突。
This commit is contained in:
walle 2025-11-19 17:38:48 +08:00
parent 743b69bb13
commit a9c38cf529
2 changed files with 5 additions and 3 deletions

View file

@ -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"
org.opencontainers.image.licenses="MIT"

View file

@ -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: