Skip to content

Commit

Permalink
2.0.5 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickwalkmsft committed Jan 30, 2018
1 parent 9375e9d commit 4d4e867
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 3 deletions.
32 changes: 32 additions & 0 deletions 2.0.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM microsoft/aspnetcore:2.0.5
MAINTAINER Azure App Services Container Images <appsvc-images@microsoft.com>

COPY bin.zip /tmp
COPY init_container.sh /bin/
COPY hostingstart.html /home/site/wwwroot/
COPY sshd_config /etc/ssh/

RUN apt-get update \
&& apt-get install -y apt-utils --no-install-recommends \
&& apt-get install -y unzip --no-install-recommends \
&& mkdir -p /defaulthome/hostingstart \
&& unzip -q -o /tmp/bin.zip -d /defaulthome/hostingstart \
&& rm /tmp/bin.zip \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt update \
&& apt install -y --no-install-recommends openssh-server vim curl wget tcptraceroute \
&& chmod 755 /bin/init_container.sh \
&& mkdir -p /home/LogFiles/

EXPOSE 2222 8080

ENV PORT 8080
ENV WEBSITE_ROLE_INSTANCE_ID localRoleInstance
ENV WEBSITE_INSTANCE_ID localInstance
ENV PATH ${PATH}:/home/site/wwwroot
ENV ASPNETCORE_URLS=

WORKDIR /home/site/wwwroot

ENTRYPOINT ["/bin/init_container.sh"]
Binary file added 2.0.5/bin.zip
Binary file not shown.
6 changes: 6 additions & 0 deletions 2.0.5/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
cd src
sudo rm -rf bin obj publish
docker run --rm -v $(pwd):/src -w /src microsoft/dotnet /bin/bash -c "dotnet restore && dotnet publish -o publish"
cd publish
zip -r ../../bin.zip *
38 changes: 38 additions & 0 deletions 2.0.5/hostingstart.html

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions 2.0.5/init_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Dotnet quickstart: https://aka.ms/dotnet-qs
EOL
cat /etc/motd

service ssh start

[ -z "$ASPNETCORE_URLS" ] && export ASPNETCORE_URLS=http://*:"$PORT"

# If there is any command line argument specified, run it
[ $# -ne 0 ] && exec "$@"

# Pick up one .csproj file from repository where git push puts files into
CSPROJ=`ls -1 /home/site/repository/*.csproj 2>/dev/null | head -1`

# Convert /home/site/repository/<name>.csproj into ./<name>.dll and execute it
if [ -n "$CSPROJ" ]; then
DLL=./`basename "$CSPROJ" .csproj`.dll
echo Found: $DLL
[ -e "$DLL" ] && exec dotnet "$DLL"
fi

echo Could not find .csproj or .dll. Using default.
cd /defaulthome/hostingstart
exec dotnet hostingstart.dll
19 changes: 19 additions & 0 deletions 2.0.5/src/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using Microsoft.AspNetCore.Hosting;

namespace hostingstart
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseStartup<Startup>()
.UseWebRoot("/home/site/wwwroot")
.Build();

host.Run();
}
}
}
21 changes: 21 additions & 0 deletions 2.0.5/src/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.FileProviders;
using Microsoft.AspNetCore.StaticFiles;

namespace hostingstart
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
var options = new DefaultFilesOptions();
options.DefaultFileNames.Add("hostingstart.html");

app.UseDefaultFiles(options)
.UseStaticFiles();
}
}
}
15 changes: 15 additions & 0 deletions 2.0.5/src/hostingstart.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions 2.0.5/sshd_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This is ssh server systemwide configuration file.
#
# /etc/sshd_config

Port 2222
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
8 changes: 5 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
!/usr/bin/env bash
set -x -e
set -euo pipefail

buildnumber=${4-$(date -u +"%y%m%d%H%M")}

docker build -t "$1"/dotnetcore:1.0.5_"$buildnumber" -t "$1"/dotnetcore:lts_"$buildnumber" 1.0.5
docker build -t "$1"/dotnetcore:1.1.2_"$buildnumber" 1.1.2
docker build -t "$1"/dotnetcore:2.0.0_"$buildnumber" -t "$1"/dotnetcore:latest_"$buildnumber" 2.0.0
docker build -t "$1"/dotnetcore:2.0.0_"$buildnumber" 2.0.0
docker build -t "$1"/dotnetcore:2.0.5_"$buildnumber" -t "$1"/dotnetcore:latest_"$buildnumber" 2.0.5

docker login -u "$2" -p "$3"

docker push "$1"/dotnetcore:lts_"$buildnumber"
docker push "$1"/dotnetcore:1.0.5_"$buildnumber"
docker push "$1"/dotnetcore:1.1.2_"$buildnumber"
docker push "$1"/dotnetcore:latest_"$buildnumber"
docker push "$1"/dotnetcore:2.0.0_"$buildnumber"
docker push "$1"/dotnetcore:2.0.5_"$buildnumber"
docker push "$1"/dotnetcore:latest_"$buildnumber"

docker logout

0 comments on commit 4d4e867

Please sign in to comment.