① server/index.ts 打开这个文件 设置端口号 // 这里需要设置端口号 const PORT = 6000;
这里也需要跟Dockerfile 文件中的端口号,保持一致
② 执行 docker-compose up -d
② ③ ④
From Node:12-alpine3.12 FROM node:18-buster-slim Debian FROM node:18-buster ubuntu
docker-compose up -d --build
npm init -y npm install typescript ts-node ts-node-dev
$ npm install -D typescript ts-node @types/node $ npm install -D @types/express
$ yarn init
$ yarn add express $ yarn add --dev @types/express @types/node typescript ts-node-dev
Makefile
up: docker-compose up -d
up-prod: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
down: docker-compose down