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.运行效果