How to use Docker with Paket?

2019-08-01 05:15发布

问题:

There are several projects in my solution (some production and some test ...) and there is a docker image per each project. Each .fsproj file in the solution contains the line:

<Import Project="..\.paket\Paket.Restore.targets" />

But docker's build context is limited by the project's folder and I'd rather not deal with that problem.

Can use Paket without the need for referring to parent folders?

回答1:

I'm not an expert, but I guess you have two options here:

  1. You can keep Paket.Restore.targets file in each project, which is not so bad IMHO.
  2. In my project I decided to build docker image from parent folder, but yes you can do this by setting build context. If you decide here is a command I use:

    docker build -t "$IMAGE:$TAG_NAME" -f "$DOCKERFILE_PATH" .

I run it from parent level, and by -f you can specify Dockerfile and . at the end sets the context for build.