Yapi是一个比较好用的api文档工具,项目地址 https://github.com/YMFE/yapi
项目地址 https://github.com/fjc0k/docker-YApi
version: '3' services: yapi-web: image: jayfong/yapi:latest container_name: yapi-web ports: # 映射到本地端口40001,也可修改为其他端口 - 40001:3000 environment: - YAPI_ADMIN_ACCOUNT=admin@docker.yapi - YAPI_ADMIN_PASSWORD=admin - YAPI_CLOSE_REGISTER=true - YAPI_DB_SERVERNAME=yapi-mongo - YAPI_DB_PORT=27017 - YAPI_DB_DATABASE=yapi - YAPI_DB_USER=admin - YAPI_DB_PASS=123456 - YAPI_DB_AUTH_SOURCE=admin - YAPI_MAIL_ENABLE=false - YAPI_LDAP_LOGIN_ENABLE=false - YAPI_PLUGINS=[] depends_on: - yapi-mongo links: - yapi-mongo restart: unless-stopped yapi-mongo: # centos7等低版本系统需要降低mongo的版本,可设置为mongo:4.2 image: mongo:latest container_name: yapi-mongo volumes: - ./data/db:/data/db # 把端口暴露给此内部容器网络(同一个Docker网络),但是不暴露给主机网络 expose: - 27017 environment: - MONGO_INITDB_ROOT_USERNAME=admin - MONGO_INITDB_ROOT_PASSWORD=123456 restart: unless-stopped
注
未指定网络的情况下,docker-compose会自动创建一个网络。这个网络的生命周期由docker compose管理,并在docker-compose up执行时创建,在docker-compose down执行时删除。
FROM node:12-alpine as builder WORKDIR /yapi RUN apk add --no-cache wget python make ENV VERSION=1.9.2 RUN wget -O yapi-${VERSION}.zip https://github.com/YMFE/yapi/archive/v${VERSION}.zip RUN unzip yapi-${VERSION}.zip && mv yapi-${VERSION} vendors RUN cd /yapi/vendors && cp config_example.json ../config.json && npm install --production --registry https://registry.npm.taobao.org FROM node:12-alpine ENV TZ="Asia/Shanghai" WORKDIR /yapi/vendors COPY --from=builder /yapi/vendors /yapi/vendors EXPOSE 3000 ENTRYPOINT ["node"]
docker run -d \ --link mongo-yapi:mongo \ --workdir /yapi \ -p 3000:3000 \ -v $PWD/config.json:/config.json \ yapi:latest \ server/app.js
这个太麻烦了
本文作者:枣子
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!