-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9375e9d
commit 4d4e867
Showing
10 changed files
with
187 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 * |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |