下面的命令表示:"一旦GULP任务‘DevelopmentBuild’完成,启动Docker":
gulp developmentBuild && docker compose -up
然而,像developmetBuild
这样的本地开发模式的任务通常永远不会结束,因为它们正在使用文件观察器,并将等待更改,直到进程被终止或发生严重错误.这developmetBuild
人可能是这样的:
gulp.task('developmetBuild', ['browser-sync', 'css-libs', 'scripts'], function() {
gulp.watch('app/sass/**/*.sass', ['sass']);
gulp.watch('app/*.html', browserSync.reload);проекта
gulp.watch(['app/js/common.js', 'app/libs/**/*.js'], browserSync.reload);
});
那么平行运行呢?
gulp developmentBuild & docker compose -up
有时,它不会奏效.例如,在下面的情况下,只有在构建了FrontServerEntryPoint
之后才能启动nodemon
.
version: "3.5"
services:
FrontServer:
image: node:16-alpine
container_name: Example-Local-FrontServer
ports: [ "8080:8080" ]
# [ Theory ] Nodemon will not be found if invoke just "nodemon". See https://linuxpip.org/nodemon-not-found/
# [ Theory ] About -L flag: https://github.com/remy/nodemon/issues/1802
command: sh -c "cd var/www/example.com && node_modules/.bin/nodemon -L 03-LocalDevelopmentBuild/FrontServerEntryPoint.js --environment local"
environment:
- DATABASE_HOST=Database
depends_on: [ Database ]
volumes:
- type: bind
source: .
target: /var/www/example.com