Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker and Paket do not integrate. #3006

Closed
Martin-Smith2 opened this issue Jan 23, 2018 · 2 comments
Closed

Docker and Paket do not integrate. #3006

Martin-Smith2 opened this issue Jan 23, 2018 · 2 comments

Comments

@Martin-Smith2
Copy link

Description

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.
So I can't access the root folder of my solution (where the .paket folder and .git lives)

On the other hand, causes the whole directory (including my test scripts) to be sent to the Docker daemon.

I also tried hard to have a .paket folder inside each of my project folders and everything works without error by the paket but using the added packages in my project throws compile errors like this:

Severity Code Description Project File Line Suppression State Error FS0039 The namespace or module 'Expecto' is not defined.

How can I use Paket in docker without the need for referring to parent folders?

@enricosada
Copy link
Collaborator

enricosada commented Jan 23, 2018

@MohsenBzm you are building inside a docker container? or just using output?

A way is to use docker multi stage builds from root.

build in one image, move generated published output to another image.
minimal size, final image doesnt have useless artifacts (or tests etc)

On the other hand, causes the whole directory (including my test scripts) to be sent to the Docker daemon.

FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app

# copy fsproj and restore as distinct layers
COPY *.fsproj ./
RUN dotnet restore

# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# build runtime image
FROM microsoft/dotnet:2.0-runtime 
WORKDIR /app
COPY --from=build-env /app/out ./
ENTRYPOINT ["dotnet", "sample4.dll"]

@Martin-Smith2
Copy link
Author

Martin-Smith2 commented Feb 27, 2018

@enricosada Multi-stage build fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants