docker 中 利用 docker-compose 搭建 node 和 Redis 环境配置

version: '3'
services:
  redis:
    image: redis:3
    container_name: redis
    hostname: redis
    command: redis-server /usr/local/etc/redis/redis.conf --requirepass yourpassword
    volumes:
      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
    ports:
      - "6379:6379"

  node:
    image: registry.cn-shenzhen.aliyuncs.com/yxw-docker/node8.9.3:latest
    container_name: node
    hostname: node
    ports:
      - "7001:7001"
    working_dir: /source/lx-egg
    links:
      - redis:redis
    volumes:
    - /source:/source
    # >在字符串中折叠换行,| 保留换行符,这两个符号是YAML中字符串经常使用的符号
    #  command:
    #     - /bin/sh
    #     - -c
    #     - |
    #     yarn install
    #     pm2-runtime start ecosystem.config.js
    command: ["/bin/sh", "-c", "yarn install && yarn dev"]

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容