porting the swarm-windows app from Docker-files-for-Windows, changing swarm tutorial to use local files

This commit is contained in:
Mano Marks 2016-04-25 18:45:25 -07:00
Родитель 154cd76975
Коммит 5b88af1c14
5 изменённых файлов: 342 добавлений и 5 удалений

63
windows/.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

212
windows/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,212 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

Просмотреть файл

@ -132,7 +132,7 @@ parameter before running the following command in place of
to 20 minutes to complete:_
<pre>
$ azure group deployment create cliEastUsSwarmRG cli-win-node --template-uri https://raw.githubusercontent.com/brogersyh/Dockerfiles-for-windows/master/dotnet-aspnet46-webapp/azuredeploy.json -p '{"adminUsername": {"value": "Azure123"}, "adminPassword": {"value": "Azure!23"}, "dnsNameForPublicIP": {"value": "<b>uniqueWindowsNodeName</b>"}, "VMName": {"value": "cli-win-node"},"location": {"value": "East US"}}'
$ azure group deployment create cliEastUsSwarmRG cli-win-node --template-uri https://raw.githubusercontent.com/docker/labs/master/windows/dotnet-aspnet46-webapp/azuredeploy.json -p '{"adminUsername": {"value": "Azure123"}, "adminPassword": {"value": "Azure!23"}, "dnsNameForPublicIP": {"value": "<b>uniqueWindowsNodeName</b>"}, "VMName": {"value": "cli-win-node"},"location": {"value": "East US"}}'
</pre>
## Provision VM host for Swarm Manager and Registry using Azure docker create
@ -249,8 +249,8 @@ eth0 Link encap:Ethernet HWaddr 00:0d:3a:12:16:7f
### Build App Linux Image
<pre>
$ git clone https://github.com/brogersyh/Dockerfiles-for-Linux.git
$ docker build -t rushhourweatherappservice Dockerfiles-for-Linux/Python-REST-Service
$ git clone https://github.com/docker/labs.git
$ docker build -t rushhourweatherappservice labs/windows/Python-REST-Service
</pre>
### Push App Linux Image to Registry
@ -302,8 +302,8 @@ Ethernet adapter Ethernet 2:
<pre>
PS > choco install git -y
PS > $env:PATH = "$env:PATH;c:\program files\git\cmd"
PS > git clone https://github.com/brogersyh/Dockerfiles-for-windows.git
PS > cd Dockerfiles-for-windows
PS > git clone https://github.com/labs.git
PS > cd labs\windows
PS > docker build -t swarm swarm-windows
</pre>

Просмотреть файл

@ -0,0 +1,28 @@
# build windows swarm executable image
# adapted from https://stefanscherer.github.io/build-docker-swarm-for-windows-the-docker-way/
FROM windowsservercore:10.0.10586.0
# install chocolatey pkg mgr
RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
ENV SWARM_VERSION v1.1.3
ENV GOROOT C:\\tools\\go
ENV GOPATH C:\\work
ENV SWARM_HOST :2375
WORKDIR /
# copy utility bat script
COPY . .
# install golang, git, godep
# build swarm windows exe
# cleanup to reduce image layer size
RUN install-and-cleanup
ENTRYPOINT powershell -Command \
sleep 2 ; \
\bin\swarm.exe
CMD ["--help"]

Просмотреть файл

@ -0,0 +1,34 @@
REM build swarm and cleanup to minimize image layer size
REM install golang, git, godep
choco install golang -y
if errorlevel 1 exit 1
SET PATH=%PATH%;%GOROOT%\bin;%GOPATH%\bin
choco install git -y
if errorlevel 1 exit 1
SET PATH=%PATH%;c:\program files\git\cmd
go get github.com/tools/godep
if errorlevel 1 exit 1
REM build swarm
mkdir %GOPATH%
mkdir %GOPATH%\src\github.com\docker
cd %GOPATH%\src\github.com\docker
git clone https://github.com/docker/swarm
if errorlevel 1 exit 1
cd swarm
git checkout %SWARM_VERSION%
if errorlevel 1 exit 1
godep go install .
if errorlevel 1 exit 1
cd \
mkdir bin
copy %GOPATH%\bin\swarm.exe bin\swarm.exe
REM cleanup to reduce image layer size
choco uninstall golang -y
if exist %GOROOT% rmdir /s /q %GOROOT%
if exist %GOPATH% rmdir /s /q %GOPATH%
choco uninstall git -y
if exist "c:\program files\git" rmdir /s /q "c:\program files\git"