我正在从事.Net项目。我正在使用VS2017作为IDE。每当我单击Docker compose时,至少需要4到5分钟才能达到断点。每当我启动时,Nuget程序包就会开始加载。我已在下面附上了屏幕截图。
下面是我的制作文件。
ASPNETCORE_ENVIRONMENT=local
IPM_POSTGRES_ADDRESS=localhost
IPM_POSTGRES_PORT=5432
IPM_POSTGRES_USERNAME=kmart
IPM_POSTGRES_PASSWORD=kmart
NUGET_PATH=~/.nuget
AVRO_PATH=~/.dotnet/tools
INSTALL_AVRO=0
ifeq ($(OS),Windows_NT)
NUGET_PATH=${USERPROFILE}\.nuget
AVRO_PATH=${USERPROFILE}\.dotnet\tools
ifeq (, $(shell where ${AVRO_PATH}:avrogen))
INSTALL_AVRO=1
endif
else
ifeq (, $(shell which ${AVRO_PATH}/avrogen))
INSTALL_AVRO=1
endif
endif
.PHONY: restore restore-src restore-tests package test verify-appsettings test-in-docker test-watch start migration-add migration-remove migration-run migration-ignore-stylecop migration-create-template migration-remove-template
restore: restore-src restore-tests
restore-src:
dotnet restore ReplenishmentService
restore-tests:
dotnet restore ReplenishmentServiceTests
test-single:
cd ReplenishmentServiceTests && ASPNETCORE_ENVIRONMENT=test dotnet test --filter "FullyQualifiedName~${TEST_NAME}"
test-unit-only: generate-avro
cd ReplenishmentServiceTests && dotnet test --filter Category!=Integration
test-watch-single:
cd ReplenishmentServiceTests && ASPNETCORE_ENVIRONMENT=test dotnet watch test --filter "FullyQualifiedName=${TEST_NAME}"
test-watch:
cd ReplenishmentServiceTests && ASPNETCORE_ENVIRONMENT=test dotnet watch test --filter Category!=Integration
test:
cd ReplenishmentServiceTests && docker-compose down
cd ReplenishmentServiceTests && docker-compose build
cd ReplenishmentServiceTests && docker-compose up -d
cd ReplenishmentServiceTests && docker-compose run dotnet-test /app/runtests.sh
cd ReplenishmentServiceTests && docker-compose down
validate-schema:
cd ReplenishmentServiceTests && docker-compose build dotnet-test
cd ReplenishmentServiceTests && docker-compose run --no-deps dotnet-test /app/validateSchema.sh
verify-appsettings:
cd ReplenishmentServiceTests && docker-compose run verify-appsettings
test-rerun-in-docker:
cd ReplenishmentServiceTests && docker-compose run dotnet-test /app/runtests.sh
clean-docker:
docker rmi -f replenishmentservice
build-docker: package
docker-compose build replenishmentservice
build-image: build-docker
prune-docker-images:
docker images -q -f dangling=true | xargs docker rmi
clean:
rm -rf ReplenishmentService/out
rm -rf ReplenishmentService/bin
rm -rf ReplenishmentServiceTests/bin
rm -rf ReplenishmentService/obj
rm -rf ReplenishmentService/Models/IPM
initialise-local-databases: initialise-local-db2 initialise-local-postgres
docker-compose up --detach replenishmentservice && \
docker-compose exec replenishmentservice bash -c "until (curl --output /dev/null --silent --fail 'http://localhost:5000/api/status'); do sleep 5; done" && \
docker-compose exec replenishmentservice bash -c "curl -id '' http://localhost:5000/api/stores/refresh" && \
docker-compose down
reload-stores-cache:
docker exec replenishmentservice bash -c "curl -id '' http://localhost:5000/api/stores/refresh"
initialise-local-databases-vb:
docker exec replenishmentservice bash -c "until (curl --output /dev/null --silent --fail 'http://localhost:5000/api/status'); do sleep 5; done" && \
docker cp scripts/pg/import_data.sql replenishment-postgres:/docker-entrypoint-initdb.d/import_data.sql && \
docker exec replenishment-postgres psql kmart kmart -f /docker-entrypoint-initdb.d/import_data.sql && \
docker exec replenishmentservice bash -c "curl --silent -id '' http://localhost:5000/api/stores/refresh"
initialise-local-postgres: migration-dump-schema
docker-compose build replenishment-postgres
initialise-local-db2: purge-local-databases
docker-compose build db2
purge-local-databases:
docker-compose down --volumes
install-avro:
ifeq (1,$(INSTALL_AVRO))
dotnet tool install --global Confluent.Apache.Avro.AvroGen
endif
AVRO_OUTDIR = ReplenishmentService/Models/IPM/ReplenishmentService
AVRO_OUTFILES = $(AVRO_OUTDIR)/ProductRangeEvent.cs $(AVRO_OUTDIR)/TimephaseUpdateEvent.cs
generate-avro: install-avro $(AVRO_OUTFILES)
$(AVRO_OUTDIR)/%.cs: ReplenishmentService/Models/%.avsc
${AVRO_PATH}/avrogen -s $< ReplenishmentService/Models
package: clean generate-avro
cd ReplenishmentService && dotnet publish -c Release -o out
start: package build-docker stop
docker-compose up
stop:
docker-compose kill && docker-compose down
rebuild: package clean-docker build-docker
docker-compose rm -f --stop replenishmentservice && docker-compose up --detach replenishmentservice
migration-remove-down:
python scripts/removeDownMigrations.py ReplenishmentService/Migrations/*
migration-create-template:
cd ReplenishmentService && dotnet ef migrations add --startup-project ReplenishmentService.csproj --context ReplenishmentParameterContext ${MIGRATION_NAME}
migration-remove-template:
cd ReplenishmentService && dotnet ef migrations remove --startup-project ReplenishmentService.csproj --context ReplenishmentParameterContext
migration-add: migration-create-template
migration-remove: migration-remove-template migration-ignore-stylecop
migration-run:
cd ReplenishmentService && ASPNETCORE_ENVIRONMENT=local IPM_POSTGRES_ADDRESS=localhost IPM_POSTGRES_PORT=5432 IPM_POSTGRES_USERNAME=kmart IPM_POSTGRES_PASSWORD=kmart dotnet ef database update --startup-project ReplenishmentService.csproj --context ReplenishmentParameterContext --verbose
migration-scaffold:
cd ReplenishmentService && dotnet ef dbcontext scaffold --startup-project ReplenishmentService.csproj --context ReplenishmentParameterContext --connection-string "
migration-dump-schema: package
cd ReplenishmentService && dotnet ef migrations script --context ReplenishmentParameterContext > ../replenishment_data/scripts/1.ipmSchema.sql
我可以知道为什么要花四到五分钟吗?还有其他方法可以减少这段时间吗?任何帮助,将不胜感激。谢谢。