Skip to content

Commit

Permalink
Split dotnet and dotnetisolated builds (#1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
pragnagopa authored Aug 17, 2024
1 parent 42f9a5e commit df67024
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 120 deletions.
2 changes: 1 addition & 1 deletion host/4/bullseye/amd64/base/host.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG HOST_VERSION=4.35.1
ARG HOST_VERSION=4.1035.1

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS runtime-image
ARG HOST_VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ RUN apt-get update && \

COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ]
COPY --from=runtime-image [ "/FuncExtensionBundles", "/FuncExtensionBundles" ]
COPY install_ca_certificates.sh start_nonappservice.sh /opt/startup/
RUN chmod +x /opt/startup/install_ca_certificates.sh && \
chmod +x /opt/startup/start_nonappservice.sh
COPY sshd_config /etc/ssh/
COPY start.sh /azure-functions-host/
COPY install_ca_certificates.sh /opt/startup/

CMD [ "/opt/startup/start_nonappservice.sh" ]
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

ENTRYPOINT ["/azure-functions-host/start.sh"]

This file was deleted.

15 changes: 15 additions & 0 deletions host/4/bullseye/amd64/dotnet/dotnet-inproc/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 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
36 changes: 36 additions & 0 deletions host/4/bullseye/amd64/dotnet/dotnet-inproc/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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

# Get environment variables to show up in SSH session
eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/g' | sed '/=/s//="/' | sed 's/$/"/' >> /etc/profile)

# starting sshd process
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
77 changes: 3 additions & 74 deletions host/4/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,73 +34,13 @@ jobs:
_inproc:
dotnetVersion: "dotnet"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet-inproc/"
dockerImagePath: "dotnet"
dockerImagePath: "dotnet-appservice"
dockerImageName: ""
_inproc-slim:
dotnetVersion: "dotnet-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet-inproc/"
dockerImagePath: "dotnet"
dockerImagePath: "dotnet-slim"
dockerImageName: "-slim"
_inproc-appservice:
dotnetVersion: "dotnet-inproc-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet"
dockerImageName: "-appservice"
_isolated-net-6:
dotnetVersion: "dotnet-isolated"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated6.0"
_isolated-slim:
dotnetVersion: "dotnet-isolated-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated6.0-slim"
_isolated-appservice:
dotnetVersion: "dotnet-isolated-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated6.0-appservice"
_isolated-net-7:
dotnetVersion: "dotnet-isolated"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet7-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0"
_isolated-net-7-slim:
dotnetVersion: "dotnet-isolated-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet7-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0-slim"
_isolated-net-7-appservice:
dotnetVersion: "dotnet7-isolated-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0-appservice"
_isolated-net-7-mariner:
dotnetVersion: "dotnet7-isolated-mariner"
dockerfilePath: "host/4/mariner/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0-mariner"
_isolated-net-8:
dotnetVersion: "dotnet-isolated"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet8-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0"
_isolated-net-8-slim:
dotnetVersion: "dotnet-isolated-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet8-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0-slim"
_isolated-net-8-appservice:
dotnetVersion: "dotnet8-isolated-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0-appservice"
_isolated-net-8-mariner:
dotnetVersion: "dotnet8-isolated-mariner"
dockerfilePath: "host/4/mariner/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0-mariner"
_bookworm-net-6:
dotnetVersion: "dotnet6"
dockerfilePath: "host/4/bookworm/dotnet/"
Expand All @@ -115,13 +55,7 @@ jobs:
dotnetVersion: "dotnet8-appservice"
dockerfilePath: "host/4/bookworm/dotnet/"
dockerImagePath: "dotnet"
dockerImageName: "-dotnet8.0-appservice"
_bookworm-net-9:
dotnetVersion: "dotnet9-appservice"
dockerfilePath: "host/4/bookworm/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated9.0-appservice"

dockerImageName: "-dotnet8.0-appservice"
steps:
- bash: |
# login
Expand All @@ -133,11 +67,6 @@ jobs:
env:
pswd: $(dockerPassword)
- bash: |
./host/generate-composite.sh -4 dotnet
displayName: create dotnet dockerfiles
continueOnError: false
- bash: |
set -e
IMAGE_NAME=azurefunctions.azurecr.io/azure-functions/4/$(dockerImagePath):$(Build.SourceBranchName)$(dockerImageName)
Expand Down
138 changes: 138 additions & 0 deletions host/4/dotnetisolated-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
pool:
vmImage: 'Ubuntu-latest'

pr:
branches:
include:
- dev
- release/4.x
paths:
include:
- host/4/bullseye/amd64/base/*
- host/4/bullseye/amd64/dotnet/*
- host/4/bookworm/dotnet/*
- host/4/mariner/dotnet/*
- host/4/dotnet-build.yml

trigger:
branches:
include:
- dev
- refs/tags/4.*
- refresh/4.*
- release/4.x
- nightly-build

variables:
- name: image_list
value: ''

jobs:
- job: Dotnet
strategy:
matrix:
_isolated-net-6:
dotnetVersion: "dotnet-isolated"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated6.0"
_isolated-slim:
dotnetVersion: "dotnet-isolated-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated6.0-slim"
_isolated-appservice:
dotnetVersion: "dotnet-isolated-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated6.0-appservice"
_isolated-net-7:
dotnetVersion: "dotnet-isolated"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet7-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0"
_isolated-net-7-slim:
dotnetVersion: "dotnet-isolated-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet7-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0-slim"
_isolated-net-7-appservice:
dotnetVersion: "dotnet7-isolated-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0-appservice"
_isolated-net-7-mariner:
dotnetVersion: "dotnet7-isolated-mariner"
dockerfilePath: "host/4/mariner/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated7.0-mariner"
_isolated-net-8:
dotnetVersion: "dotnet-isolated"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet8-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0"
_isolated-net-8-slim:
dotnetVersion: "dotnet-isolated-slim"
dockerfilePath: "host/4/bullseye/amd64/dotnet/dotnet8-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0-slim"
_isolated-net-8-appservice:
dotnetVersion: "dotnet8-isolated-appservice"
dockerfilePath: "host/4/bullseye/amd64/out/dotnet/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0-appservice"
_isolated-net-8-mariner:
dotnetVersion: "dotnet8-isolated-mariner"
dockerfilePath: "host/4/mariner/dotnet/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated8.0-mariner"
_isolated-net-9:
dotnetVersion: "dotnet9-appservice"
dockerfilePath: "host/4/bookworm/dotnet-isolated/"
dockerImagePath: "dotnet-isolated"
dockerImageName: "-dotnet-isolated9.0-appservice"

steps:
- bash: |
# login
set -e
echo $pswd | docker login -u $(dockerUsername) --password-stdin azurefunctions.azurecr.io
displayName: login to registry
continueOnError: false
env:
pswd: $(dockerPassword)
- bash: |
./host/generate-composite.sh -4 dotnet
displayName: create dotnet dockerfiles
continueOnError: false
- bash: |
set -e
IMAGE_NAME=azurefunctions.azurecr.io/azure-functions/4/$(dockerImagePath):$(Build.SourceBranchName)$(dockerImageName)
IMAGE_ARRAY="$(image_list),$IMAGE_NAME"
echo "##vso[task.setvariable variable=image_list;]$IMAGE_NAME"
docker build -t $IMAGE_NAME \
-f $(dockerfilePath)$(dotnetVersion).Dockerfile \
$(dockerfilePath)
npm run test $IMAGE_NAME --prefix test/
docker push $IMAGE_NAME
displayName: $(dotnetVersion)
continueOnError: false
- job: Publish
dependsOn: Dotnet
steps:
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Manifest Generator'
inputs:
BuildDropPath: host
Verbosity: Verbose
DockerImagesToScan: $(image_list)

- task: PublishPipelineArtifact@1
displayName: 'Publish SBOM Artifact'
inputs:
targetPath: host/_manifest
artifact: SBOM-Functionsv4-dotnet-$(Build.SourceBranchName)

0 comments on commit df67024

Please sign in to comment.