docker-compose 部署eggjs

1.目录结构

docker-compose.yaml  Dockerfile  egg

2.docker-compose.yaml

version: '2'
services:
  egg_test:
    build: .
    ports:
      - "3002:7001"

3.Dockerfile

FROM node:16.3.0
RUN mkdir -p /home/dockerfile/egg-example
WORKDIR /home/dockerfile/egg-example
RUN npm -g install npm:latest
COPY egg/ /home/dockerfile/egg-example
RUN npm i
EXPOSE 7001
CMD npm run dev

4.egg

egg项目

5.构建

docker-compose -f docker-compose.yaml up --build

6.运行效果

http://127.0.0.1:3002/

上一篇:PLC与变频器联机注意事项


下一篇:CentOS安装Docker和Docker Compose