Updates application port to 3004
WHAT: Updates the application's default port from 8080 to 3004 across various Docker configurations and scripts. This includes changes to Dockerfiles, docker-compose files, and startup scripts. Also updates the vite config. WHY: Standardizes the port used by the application to 3004 for consistency and to avoid potential conflicts with other services that might be using port 8080. HOW: Modifies the `EXPOSE` directives in the Dockerfiles, the port mappings in the docker-compose files, the default port in the main application server file, the port in the vite config and the scripts that display the API URL.
This commit is contained in:
parent
1b16056075
commit
31801d0991
8 changed files with 11 additions and 10 deletions
|
|
@ -15,7 +15,7 @@ COPY server/src ./server/src
|
||||||
|
|
||||||
RUN cd server && npm install --build-from-source && npm run build
|
RUN cd server && npm install --build-from-source && npm run build
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 3004
|
||||||
CMD ["node", "server/dist/index.js"]
|
CMD ["node", "server/dist/index.js"]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ RUN cd server && npm install --omit=dev --build-from-source
|
||||||
COPY server/dist ./server/dist
|
COPY server/dist ./server/dist
|
||||||
COPY dist ./frontend
|
COPY dist ./frontend
|
||||||
|
|
||||||
ENV PORT=8080
|
ENV PORT=3004
|
||||||
ENV DB_PATH=/data/purchase.db
|
ENV DB_PATH=/data/purchase.db
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 3004
|
||||||
CMD ["node", "server/dist/index.js"]
|
CMD ["node", "server/dist/index.js"]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ services:
|
||||||
image: dm-purchase-api:dev
|
image: dm-purchase-api:dev
|
||||||
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
platform: ${DOCKER_PLATFORM:-linux/amd64}
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "3004:3004"
|
||||||
environment:
|
environment:
|
||||||
- DB_PATH=/data/purchase.db
|
- DB_PATH=/data/purchase.db
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ services:
|
||||||
image: dm-purchase-api:prod
|
image: dm-purchase-api:prod
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "3004:3004"
|
||||||
environment:
|
environment:
|
||||||
- DB_PATH=/data/purchase.db
|
- DB_PATH=/data/purchase.db
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ fi
|
||||||
echo "[步骤] 启动 Docker Compose (开发)"
|
echo "[步骤] 启动 Docker Compose (开发)"
|
||||||
(cd "$ROOT_DIR/docker" && DOCKER_PLATFORM=${DOCKER_PLATFORM} docker compose -f docker-compose.dev.yml up -d --build)
|
(cd "$ROOT_DIR/docker" && DOCKER_PLATFORM=${DOCKER_PLATFORM} docker compose -f docker-compose.dev.yml up -d --build)
|
||||||
|
|
||||||
echo "[完成] API: http://localhost:8080"
|
echo "[完成] API: http://localhost:3004"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ fi
|
||||||
echo "[步骤] 启动 Docker Compose (生产)"
|
echo "[步骤] 启动 Docker Compose (生产)"
|
||||||
(cd "$ROOT_DIR/docker" && docker compose -f docker-compose.prod.yml up -d --build)
|
(cd "$ROOT_DIR/docker" && docker compose -f docker-compose.prod.yml up -d --build)
|
||||||
|
|
||||||
echo "[完成] API: http://localhost:8080"
|
echo "[完成] API: http://localhost:3004"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ app.patch('/api/items/:id/purchased', (req, res) => {
|
||||||
res.json({ ok: true });
|
res.json({ ok: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
const port = Number(process.env.PORT || 8080);
|
const port = Number(process.env.PORT || 3004);
|
||||||
// Serve prebuilt frontend when present (production)
|
// Serve prebuilt frontend when present (production)
|
||||||
const frontendDir = path.resolve(process.cwd(), 'frontend');
|
const frontendDir = path.resolve(process.cwd(), 'frontend');
|
||||||
if (fs.existsSync(frontendDir)) {
|
if (fs.existsSync(frontendDir)) {
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,14 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
port: 3003,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:8080',
|
target: 'http://localhost:3004',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/health': {
|
'/health': {
|
||||||
target: 'http://localhost:8080',
|
target: 'http://localhost:3004',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue