使用docker-compose组件镜像容器

docker-compose up
docker-compose down

nginx

托管静态目录

version: '3'
services:
  i18n_nginx_static:
    image: nginx:1.13.8-alpine
    restart: always
    working_dir: /home/static
    volumes:
       - ./dist:/usr/share/nginx/html
    ports:
      - 6098:80

NodeJS

启动NodeJS App

version: '3'
services:
  pg:
    image: postgres:9.6.6-alpine
    restart: always
    volumes:
      - "./docker/volumes/pg:/var/lib/postgresql/data"
    ports:
      - 6432:5432
  node:
    image: keymetrics/pm2:8-alpine
    user: "node"
    working_dir: /home/node/app
    environment:
      - NODE_ENV=production
    volumes:
      - ./:/home/node/app
    ports:
      - 6099:6099
    links:
      - pg

最后

记录下我写的 Docker compose 配置集合,集合了一些常用的配置

https://github.com/axetroy/docker-configuration