Skip to content
This repository was archived by the owner on May 31, 2019. It is now read-only.

Conversation

@glennc
Copy link
Member

@glennc glennc commented Oct 10, 2016

Add usage example and a note about ports.

@MichaelSimons, @troydai, @shirhatti

Add usage example and a note about ports.
@shirhatti
Copy link

Shouldn't this be in a README in the root of the repo? Seems applicable to all images

@glennc
Copy link
Member Author

glennc commented Oct 10, 2016

The README is specific to the image, it cannot be in the root

@glennc
Copy link
Member Author

glennc commented Oct 10, 2016

We should have a README in the root I suppose, I will do another PR.


```
$ docker build -t myapp .
$ docker run -d -P myapp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might confuse people by using the publish-all flag. I'd much rather call out an explicit port e.g., -p 8000:80.

```
FROM microsoft/aspnetcore
WORKDIR /app
ADD /app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not seen ADD used with only one arg. Did you intend for a '.' someplace?

Aside from that, I would suggest using COPY vs ADD per the Dockerfile best practices.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definately, I typed this directly in the browser. Will change to COPY and add ..

```
FROM microsoft/aspnetcore
WORKDIR /app
COPY . /app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no objection to this but I personally prefer COPY . . mainly because it makes changing the application directory easier since it is only specified in one place. Since this is a sample, I would think there is a good chance people would copy and tweak it - such as change the app directory name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm. That's a fair call. I have always preferred being explicit about it, COPY . . seemed like crazy magic. But I totally buy your argument and think I'll change it.

@glennc
Copy link
Member Author

glennc commented Oct 10, 2016

Added an update to the README of the build image. Need comments on the TODO statement I left there if nothing else :)


Now you have built your ASP.NET Core application inside a container and have the published output on the host ready to deploy. From here you could then construct an optimized runtime image with the `microsoft/aspnetcore` image or just deploy/run the binaries as normal without using Docker at runtime.

###TODO: I think everything below this line we could cut, and maybe have them as an example in a samples repo. In fact I think a set of samples that show using this technique end-to-end should be published.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, we are going this way with the dotnet-docker and dotnet-docker-samples repos. FYI - The samples are still very much a WIP.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Richard sent me a link to that, I am about to send a PR to it to start a sample that does what I am describing here with a console app and the dotnet images.

@shirhatti
Copy link

Agreed.

Everything below the TODO needs to live in a doc with an accompanying sample.
How to use the build image from a CI scenario would be very useful. We just definitely need to get that doc queued up if it isn't already @spboyer

@spboyer
Copy link

spboyer commented Oct 11, 2016

@shirhatti There is a discussion now with the team concerning a doc for the CI tutorials.

@glennc glennc merged commit 0b0ee8c into master Oct 12, 2016
@natemcmaster natemcmaster deleted the glennc-patch-1 branch December 7, 2016 17:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.