Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Conversation

@fbeltrao
Copy link
Member

Hi,

I've added Docker support to the sample projects. There is a problem with webpack in the React MusicStore sample.

This is related to issue #768.

The file DockerSupport.md explains the problem and the solution.

Please let me know if you need more information.

@dnfclas
Copy link

dnfclas commented Mar 20, 2017

@fbeltrao,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla2.dotnetfoundation.org.

It will cover your contributions to all .NET Foundation-managed open source projects.
Thanks,
.NET Foundation Pull Request Bot

@dnfclas
Copy link

dnfclas commented Mar 20, 2017

@fbeltrao, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, .NET Foundation Pull Request Bot

@fbeltrao fbeltrao changed the title Added Docker support for Sample projects Added docker support to sample projects Mar 20, 2017
@EduardTheThird
Copy link

EduardTheThird commented Mar 22, 2017

Thank you for adding the Docker samples!

Will it be possible to add a example of using a Windows Container (microsoft/dotnet:nanoserver)?
I've been working on a Windows Container version. Currently it installs Node usings PowerShell and builds / publishes, however the site is not viewable once deployed in the container.

It still needs to be optimized and moving to dotnet:nanoserver-runtime should help with the large size thereof.

FROM microsoft/dotnet:nanoserver

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 6.10.0
ENV NODE_SHA256 39c809fe02863963a4bb1eaa0daec59abcc92c0331447c3d3e06392a7f72b79c

RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
		if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \
    Expand-Archive node.zip -DestinationPath C:\ ; \
    Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
    New-Item $($env:APPDATA + '\npm') ; \
    $env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
    Remove-Item -Path node.zip

COPY . /app

WORKDIR /app
RUN ["dotnet", "restore"]
RUN ["dotnet", "publish -o out"]

WORKDIR /app/out

ENV ASPNETCORE_URLS http://+:80
EXPOSE 80/tcp

ENTRYPOINT ["dotnet", "MusicStore.dll"]
CMD ["dotnet", "run", "--server.urls", "http://*:80"]

@SteveSandersonMS
Copy link
Member

@fbeltrao Thanks very much for this contribution!

I'm not sure if you're familiar with the history, but we used to include Dockerfiles, but specifically removed them for consistency with other ASP.NET templates, and to reduce the concept count - this was in commit c9526dd. I don't think we'll want to re-add that as a default feature in the templates.

That said, the information you've provided is really high quality and will be valuable to anyone who does want to use Docker with these kinds of projects. People often do ask about it, so it would be great to have an official place to maintain this information.

Would you be OK with this information being added to the repo's wiki? We're only just getting started there, but the idea is to build up a repository of knowledge around related topics, and this would be a perfect fit.

@SteveSandersonMS SteveSandersonMS mentioned this pull request Mar 22, 2017
@fbeltrao
Copy link
Member Author

@SteveSandersonMS I was not aware of the Dockerfile consistency, sorry about that.
Of course you can add this information to the wiki page. Glad I can help.

Regards

@SteveSandersonMS
Copy link
Member

Thanks! I'll mark this as closed then.

Would you be willing to provide the content to go in this wiki page? https://github.com/aspnet/JavaScriptServices/wiki/DockerSupport

I think the topics people will want to know about would be:

  • What Dockerfile is needed for local development
  • What Dockerfile is needed for publishing (if different)
  • Any specific VS2017 instructions

Does that sound right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants