切片服务(tilesrv)
FROM node:14.17.3 WORKDIR /tilesrv RUN npm install -g cnpm --registry=https://registry.npm.taobao.org RUN cnpm install pm2 -g COPY ./package.json /tilesrv/package.json RUN cnpm i COPY . /tilesrv EXPOSE 3000 ENV LD_LIBRARY_PATH=/tilesrv/bin:$LD_LIBRARY_PATH CMD ["pm2-runtime", "start.js", "-i", "4"] FROM node:14.17.3 WORKDIR /tilesrv RUN npm install -g cnpm --registry=https://registry.npm.taobao.org RUN npm install pm2 -g COPY ./package.json /tilesrv/package.json RUN npm i COPY . /tilesrv EXPOSE 3011 ENV LD_LIBRARY_PATH=/tilesrv/bin:$LD_LIBRARY_PATH CMD ["pm2-runtime", "start.js", "-i", "4"]n FROM node:14.17.3 WORKDIR /tilesrv # 安装cnpm RUN npm install -g cnpm --registry=https://registry.npm.taobao.org # 设置工作目录 WORKDIR /tilesrv # 将package.json和package-lock.json(如果有)复制到容器中 COPY ./package.json /tilesrv/package.json COPY ./package-lock.json /tilesrv/package-lock.json # 安装项目依赖,使用npm RUN npm install # 将项目的所有文件复制到容器中 COPY . /tilesrv # 暴露容器的3000端口 EXPOSE 3000 # 运行应用程序 CMD ["./node_modules/.bin/pm2-runtime", "start.js", "-i", "4"] FROM node:14.17.3 WORKDIR /tilesrv # 安装cnpm RUN npm install -g cnpm --registry=https://registry.npm.taobao.org # 设置工作目录 WORKDIR /tilesrv # 将package.json和yarn.lock(如果有)复制到容器中 COPY ./package.json /tilesrv/package.json COPY ./yarn.lock /tilesrv/yarn.lock # 安装项目依赖,使用yarn RUN yarn install # 将项目的所有文件复制到容器中 COPY . /tilesrv # 暴露容器的3000端口 EXPOSE 3000 # 运行应用程序 CMD ["yarn", "run", "start"]
docker run -dit --name tilesrv --restart=always \ -p 3000:3000 \ -e TZ=Asia/Shanghai \ --network=my-network -v /home/dockerdata/bjgmkdata/tilesrv:E:/doc/cs/slice \ tilesrv:1.0
docker run -dit --name tilesrv --network=host --restart=always -p 3011:3011 -e TZ=Asia/Shanghai tilesrv:1.0