SAFE-BookStore icon indicating copy to clipboard operation
SAFE-BookStore copied to clipboard

Build project in docker it self

Open kunjee17 opened this issue 8 years ago • 2 comments

It is more of a question then an issue. So, feel free to close it. And I m docker noob, so don't mind my queries. Didn't find better place to ask so asking here.

# Sample contents of Dockerfile
 # Stage 1
 FROM microsoft/aspnetcore-build AS builder
 WORKDIR /source

 # caches restore result by copying csproj file separately
 COPY *.csproj .
 RUN dotnet restore

 # copies the rest of your code
 COPY . .
 RUN dotnet publish --output /app/ --configuration Release

 # Stage 2
 FROM microsoft/aspnetcore
 WORKDIR /app
 COPY --from=builder /app .
 ENTRYPOINT ["dotnet", "myapp.dll"]

This snippet is from official aspnetcore build image. Can't we do similar thing with this project.

Stage1 to build & test and Stage 2 to run.

Question

  1. It will create two images or single image ?
  2. In case of two images what will happen to second image?
  3. In case of one image how can it will be two, one will build and test and other will deployed and run.

Again I apologise if question is totally out of context.

kunjee17 avatar Nov 03 '17 12:11 kunjee17

Yes, we could do build inside a docker - actually, that was the plan when I've been thinking about CirlceCI build, I need to get back to it.

The problem is that our docker image needs to be a bit more complex than simple ASP.Net Core one - we need to install node (for Fable parts), mono (Paket & FAKE), and .Net Core (well, that is also installed with FAKE script, so can be omitted in the image)

Krzysztof-Cieslak avatar Nov 03 '17 13:11 Krzysztof-Cieslak

@Krzysztof-Cieslak I guess then mono image would be better. But anyways thanks for answer. 👍

kunjee17 avatar Nov 03 '17 14:11 kunjee17