@@ -23,34 +23,34 @@ bootstrap:
2323 && git config --global user.name "Earthly Build"
2424 # I'm using Invoke-Build tasks from this other repo which rarely changes
2525 COPY tasks+tasks/* /Tasks
26- # Dealing with dependencies first allows docker to cache packages for us
27- # So the dependency cach only re-builds when you add a new dependency
26+ # Dealing with dependencies first allows earthly ( docker) to cache layers for us
27+ # So the dependency cache only re-builds when you change the list in these files
2828 COPY build.requires.psd1 .
2929 # COPY *.csproj .
3030 RUN ["pwsh" , "-File" , "/Tasks/_Bootstrap.ps1" , "-RequiresPath" , "build.requires.psd1" ]
3131
3232build :
3333 FROM +bootstrap
3434 RUN mkdir $OUTPUT_ROOT $TEST_ROOT $TEMP_ROOT
35+ # make sure you have output folders (like bin, obj, Modules) in .earthlyignore
36+ # NOTE: we copy .git because we use GitVersion in the build to calculate the version
37+ # To avoid that, we could pass the version as an ARG
3538 COPY . .
36- # make sure you have bin and obj in .earthlyignore, as their content from context might cause problems
3739 RUN ["pwsh" , "-Command" , "Invoke-Build" , "-Task" , "Build" , "-File" , "Build.build.ps1" ]
3840
3941 # SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
4042 SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME
4143
4244test :
43- # If we run a target as a reference in FROM or COPY, it's outputs will not be produced
4445 FROM +build
45- # make sure you have bin and obj in .earthlyignore, as their content from context might cause problems
4646 RUN ["pwsh" , "-Command" , "Invoke-Build" , "-Task" , "Test" , "-File" , "Build.build.ps1" ]
4747
4848 # re-output the build output so we can rely on running just +test locally
4949 SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME
5050 SAVE ARTIFACT $TEST_ROOT AS LOCAL ./Modules/$MODULE_NAME -TestResults
5151
5252all :
53- BUILD +build
53+ # If we only reference with FROM (or COPY) the outputs will not be produced
5454 BUILD +test
5555 FROM +build
5656 RUN --push --secret NUGET_API_KEY --secret PSGALLERY_API_KEY -- \
0 commit comments