-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.NET 8 in proc changes for dedicated linux images (#1096)
- Loading branch information
1 parent
edf44c1
commit 729ca85
Showing
11 changed files
with
205 additions
and
1 deletion.
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,40 @@ | ||
# Build the runtime from source | ||
ARG HOST_VERSION=4.834.0 | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim-amd64 AS runtime-image | ||
ARG HOST_VERSION | ||
|
||
ENV PublishWithAspNetCoreTargetManifest=false | ||
|
||
RUN BUILD_NUMBER=$(echo ${HOST_VERSION} | cut -d'.' -f 3) && \ | ||
git clone --branch v${HOST_VERSION} https://github.com/Azure/azure-functions-host /src/azure-functions-host && \ | ||
cd /src/azure-functions-host && \ | ||
HOST_COMMIT=$(git rev-list -1 HEAD) && \ | ||
dotnet publish -v q /p:BuildNumber=$BUILD_NUMBER /p:CommitHash=$HOST_COMMIT src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj -c Release --output /azure-functions-host --runtime linux-x64 --framework net8.0 --self-contained /p:MinorVersionPrefix=8 && \ | ||
mv /azure-functions-host/workers /workers && mkdir /azure-functions-host/workers && \ | ||
rm -rf /root/.local /root/.nuget /src | ||
|
||
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-bookworm-slim-amd64 | ||
ARG HOST_VERSION | ||
|
||
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ | ||
HOME=/home \ | ||
FUNCTIONS_WORKER_RUNTIME=dotnet \ | ||
DOTNET_USE_POLLING_FILE_WATCHER=true \ | ||
HOST_VERSION=${HOST_VERSION} \ | ||
ASPNETCORE_CONTENTROOT=/azure-functions-host \ | ||
ASPNETCORE_URLS=http://+:80 | ||
|
||
COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ] | ||
COPY sshd_config /etc/ssh/ | ||
COPY start.sh /azure-functions-host/ | ||
COPY install_ca_certificates.sh /opt/startup/ | ||
|
||
EXPOSE 2222 80 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends openssh-server dialog && \ | ||
echo "root:Docker!" | chpasswd && \ | ||
chmod +x /azure-functions-host/start.sh && \ | ||
chmod +x /opt/startup/install_ca_certificates.sh | ||
|
||
CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ] |
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,29 @@ | ||
# Build the runtime from source | ||
ARG HOST_VERSION=4.834.0 | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim-amd64 AS runtime-image | ||
ARG HOST_VERSION | ||
|
||
ENV PublishWithAspNetCoreTargetManifest=false | ||
|
||
RUN BUILD_NUMBER=$(echo ${HOST_VERSION} | cut -d'.' -f 3) && \ | ||
git clone --branch v${HOST_VERSION} https://github.com/Azure/azure-functions-host /src/azure-functions-host && \ | ||
cd /src/azure-functions-host && \ | ||
HOST_COMMIT=$(git rev-list -1 HEAD) && \ | ||
dotnet publish -v q /p:BuildNumber=$BUILD_NUMBER /p:CommitHash=$HOST_COMMIT src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj -c Release --output /azure-functions-host --runtime linux-x64 --framework net8.0 --self-contained /p:MinorVersionPrefix=8 && \ | ||
mv /azure-functions-host/workers /workers && mkdir /azure-functions-host/workers && \ | ||
rm -rf /root/.local /root/.nuget /src | ||
|
||
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-bookworm-slim-amd64 | ||
ARG HOST_VERSION | ||
|
||
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ | ||
HOME=/home \ | ||
FUNCTIONS_WORKER_RUNTIME=dotnet \ | ||
DOTNET_USE_POLLING_FILE_WATCHER=true \ | ||
HOST_VERSION=${HOST_VERSION} \ | ||
ASPNETCORE_CONTENTROOT=/azure-functions-host \ | ||
ASPNETCORE_URLS=http://+:80 | ||
|
||
COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ] | ||
|
||
CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ] |
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,17 @@ | ||
#!/bin/bash | ||
|
||
# Source and destination directories | ||
source_dir="/var/ssl/root" | ||
destination_dir="/usr/local/share/ca-certificates" | ||
|
||
# Check if the source directory has no files with the .crt extension | ||
if [ "$(ls "$source_dir"/*.crt 2>/dev/null)" ]; then | ||
|
||
# Copy CA certificates | ||
cp "$source_dir"/*.crt "$destination_dir" | ||
|
||
# Run update-ca-certificates command to update the CA certificate store | ||
update-ca-certificates | ||
|
||
echo "CA certificates copied and updated successfully." | ||
fi |
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 SSH_PORT | ||
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
export DOTNET_USE_POLLING_FILE_WATCHER=true | ||
|
||
if [ -z $PORT ]; then | ||
export ASPNETCORE_URLS=http://*:80 | ||
else | ||
export ASPNETCORE_URLS=http://*:$PORT | ||
fi | ||
|
||
# Install ca-certificates | ||
source /opt/startup/install_ca_certificates.sh | ||
|
||
if [ -z $SSH_PORT ]; then | ||
export SSH_PORT=2222 | ||
fi | ||
|
||
if [ "$APPSVC_REMOTE_DEBUGGING" == "TRUE" ]; then | ||
export languageWorkers__node__arguments="--inspect=0.0.0.0:$APPSVC_TUNNEL_PORT" | ||
export languageWorkers__python__arguments="-m ptvsd --host localhost --port $APPSVC_TUNNEL_PORT" | ||
fi | ||
|
||
sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config | ||
|
||
service ssh start | ||
|
||
if [ -f /azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost ]; then | ||
/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost | ||
else | ||
dotnet /azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost.dll | ||
fi |
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
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
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
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
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
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