Skip to content

Commit

Permalink
Extract Base Image for V4 (#551)
Browse files Browse the repository at this point in the history
* Created v4 Host

* Rebase complete

* Enable v4 on script

* Update dotnet

* Updated Node

* Updated Python

* Updated v4 pipelines

* Updated Builds, Release artifacts for v3

* Enabled Dotnet in Supported Langs

* Commit script from linux

* Fix dotnet. Update pipelines

* Updated Perm on Script

* Fixed Dir Typo

* Target Dotnet Build

* Removed Node Grpc Ext

* Fixed python pipelines

* Update artifact release

* Remove v1 ext

* Include unzip in v4

* Update release flow for v4

* Testing v3 release

* Update release

* Verified asset publish on release

* Implement Bala's Review

Co-authored-by: Cooper Link <[email protected]>
  • Loading branch information
CooperLink and Cooper Link authored Nov 18, 2021
1 parent fb9f07d commit 485c0ef
Show file tree
Hide file tree
Showing 31 changed files with 499 additions and 695 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
ref: dev
fetch-depth: 0
token: ${{ secrets.PIPELINE_ADMIN }}
- name: Generate Image Artifacts
- name: Create Release Tag
id: createBranch
run: |
set -e
Expand All @@ -27,8 +27,6 @@ jobs:
git fetch --all
git checkout -b ${{ github.event.inputs.targetBranch }} origin/${{ github.event.inputs.targetBranch }}
git merge dev
./host/3.0/buster/amd64/base/generate-composite.sh -r all
zip -r version3images.zip ./host/3.0/buster/amd64/release/
git tag ${{ github.event.inputs.version }}
git push
git push origin ${{ github.event.inputs.version }}
Expand All @@ -41,11 +39,22 @@ jobs:
tag: ${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attach v3 Assets to Release
- name : Generate v3 Assets
if : startsWith(github.event.inputs.version, '3')
run: |
./host/generate-composite.sh -3 -r all
zip -r ${{ github.event.inputs.version }}.zip ./host/3.0/buster/amd64/release/
- name : Generate v4 Assets
if : startsWith(github.event.inputs.version, '4')
run: |
./host/generate-composite.sh -4 -r all
zip -r ${{ github.event.inputs.version }}.zip ./host/4/bullseye/amd64/release/
- name: Attach Assets to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./version3images.zip
asset_name: version3images
asset_path: ./${{ github.event.inputs.version }}.zip
asset_name: ${{ github.event.inputs.version }}-appservice.zip
asset_content_type: application/zip
4 changes: 2 additions & 2 deletions host/3.0/buster/amd64/base/host.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ ARG HOST_VERSION=3.4.1
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS runtime-image
ARG HOST_VERSION

ENV PublishWithAspNetCoreTargetManifest=false
ENV DEBIAN_FRONTEND=noninteractive
ENV PublishWithAspNetCoreTargetManifest=false \
DEBIAN_FRONTEND=noninteractive

RUN BUILD_NUMBER=$(echo ${HOST_VERSION} | cut -d'.' -f 3) && \
git clone --branch v${HOST_VERSION} https://github.com/Azure/azure-functions-host.git /src/azure-functions-host && \
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1
ARG HOST_VERSION

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
HOME=/home \
FUNCTIONS_WORKER_RUNTIME=dotnet \
DOTNET_USE_POLLING_FILE_WATCHER=true \
HOST_VERSION=${HOST_VERSION}

COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ]
COPY --from=runtime-image [ "/FuncExtensionBundles", "/FuncExtensionBundles" ]

EXPOSE 2222 80

RUN apt-get update && \
apt-get install -y --no-install-recommends gnupg wget unzip curl dialog openssh-server && \
# Add remote dotnet debugger
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v vs2017u5 -l /root/vsdbg && \
echo "root:Docker!" | chpasswd

# Chrome headless dependencies
# https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
RUN apt-get install -y xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

COPY sshd_config /etc/ssh/
COPY start.sh /azure-functions-host/

RUN chmod +x /azure-functions-host/start.sh

ENTRYPOINT ["/azure-functions-host/start.sh"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM mcr.microsoft.com/dotnet/runtime:5.0
ARG HOST_VERSION

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
HOME=/home \
FUNCTIONS_WORKER_RUNTIME=dotnet-isolated \
DOTNET_USE_POLLING_FILE_WATCHER=true \
HOST_VERSION=${HOST_VERSION}

COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ]
COPY --from=runtime-image [ "/FuncExtensionBundles", "/FuncExtensionBundles" ]

EXPOSE 2222 80

RUN apt-get update && \
apt-get install -y --no-install-recommends gnupg wget unzip curl dialog openssh-server && \
# Add remote dotnet debugger
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v vs2017u5 -l /root/vsdbg && \
echo "root:Docker!" | chpasswd

# Chrome headless dependencies
# https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
RUN apt-get install -y xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

COPY sshd_config /etc/ssh/
COPY start.sh /azure-functions-host/

RUN chmod +x /azure-functions-host/start.sh

ENTRYPOINT ["/azure-functions-host/start.sh"]
14 changes: 10 additions & 4 deletions host/3.0/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ steps:
continueOnError: false
env:
pswd: $(dockerPassword)
- bash: |
./host/generate-composite.sh -3 dotnet
displayName: create dotnet-appservice dockerfiles
continueOnError: false
- bash: |
set -e
Expand Down Expand Up @@ -65,8 +71,8 @@ steps:
IMAGE_NAME=azurefunctions.azurecr.io/azure-functions/3.0/dotnet:$(Build.SourceBranchName)-appservice
docker build -t $IMAGE_NAME \
-f host/3.0/buster/amd64/dotnet/dotnet-inproc/dotnet-appservice.Dockerfile \
host/3.0/buster/amd64/dotnet/dotnet-inproc/
-f host/3.0/buster/amd64/out/dotnet/dotnet-inproc-appservice.Dockerfile \
host/3.0/buster/amd64/out/dotnet/
npm run test $IMAGE_NAME --prefix test/
docker push $IMAGE_NAME
displayName: dotnet-appservice
Expand Down Expand Up @@ -102,8 +108,8 @@ steps:
IMAGE_NAME=azurefunctions.azurecr.io/azure-functions/3.0/dotnet-isolated:$(Build.SourceBranchName)-dotnet-isolated5.0-appservice
docker build -t $IMAGE_NAME \
-f host/3.0/buster/amd64/dotnet/dotnet-isolated/dotnet-isolated-appservice.Dockerfile \
host/3.0/buster/amd64/dotnet/dotnet-isolated/
-f host/3.0/buster/amd64/out/dotnet/dotnet-isolated-appservice.Dockerfile \
host/3.0/buster/amd64/out/dotnet/
npm run test $IMAGE_NAME --prefix test/
docker push $IMAGE_NAME
displayName: dotnet-isolated-appservice (.NET 5)
Expand Down
2 changes: 1 addition & 1 deletion host/3.0/java-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ steps:
pswd: $(dockerPassword)
- bash: |
./host/3.0/buster/amd64/base/generate-composite.sh java
./host/generate-composite.sh -3 java
displayName: create java-appservice dockerfiles
continueOnError: false
Expand Down
2 changes: 1 addition & 1 deletion host/3.0/node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ steps:
pswd: $(dockerPassword)
- bash: |
./host/3.0/buster/amd64/base/generate-composite.sh node
./host/generate-composite.sh -3 node
displayName: create node-appservice dockerfiles
continueOnError: false
Expand Down
8 changes: 4 additions & 4 deletions host/3.0/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
pswd: $(dockerPassword)
- bash: |
./host/3.0/buster/amd64/base/generate-composite.sh python
./host/generate-composite.sh -3 python
displayName: create python-appservice dockerfiles
continueOnError: false
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
pswd: $(dockerPassword)
- bash: |
./host/3.0/buster/amd64/base/generate-composite.sh python
./host/generate-composite.sh -3 python
displayName: create python-appservice dockerfiles
continueOnError: false
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
pswd: $(dockerPassword)
- bash: |
./host/3.0/buster/amd64/base/generate-composite.sh python
./host/generate-composite.sh -3 python
displayName: create python-appservice dockerfiles
continueOnError: false
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
pswd: $(dockerPassword)
- bash: |
./host/3.0/buster/amd64/base/generate-composite.sh python
./host/generate-composite.sh -3 python
displayName: create python-appservice dockerfiles
continueOnError: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
# Build the runtime from source
ARG HOST_VERSION=4.0.1.16815
ARG JAVA_VERSION=8u292

FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.2 AS runtime-image
ARG HOST_VERSION

ENV PublishWithAspNetCoreTargetManifest=false
RUN echo "HOST_VARSION: "${HOST_VERSION}
ENV PublishWithAspNetCoreTargetManifest=false \
DEBIAN_FRONTEND=noninteractive

RUN BUILD_NUMBER=$(echo ${HOST_VERSION} | cut -d'.' -f 4) && \
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 && \
mv /azure-functions-host/workers /workers && mkdir /azure-functions-host/workers && \
rm -rf /root/.local /root/.nuget /src
rm -rf /root/.local /root/.nuget /src \;

RUN EXTENSION_BUNDLE_VERSION=1.8.1 && \
EXTENSION_BUNDLE_FILENAME=Microsoft.Azure.Functions.ExtensionBundle.1.8.1_linux-x64.zip && \
apt-get update && \
RUN apt-get update && \
apt-get install -y gnupg wget unzip && \
wget https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/$EXTENSION_BUNDLE_VERSION/$EXTENSION_BUNDLE_FILENAME && \
mkdir -p /FuncExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/$EXTENSION_BUNDLE_VERSION && \
unzip /$EXTENSION_BUNDLE_FILENAME -d /FuncExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/$EXTENSION_BUNDLE_VERSION && \
rm -f /$EXTENSION_BUNDLE_FILENAME && \
find /FuncExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/$EXTENSION_BUNDLE_VERSION/bin/runtimes/ -mindepth 1 -type d -not -name "linux-x64" -prune -exec rm -rf {} + && \
EXTENSION_BUNDLE_VERSION_V2=2.8.3 && \
EXTENSION_BUNDLE_FILENAME_V2=Microsoft.Azure.Functions.ExtensionBundle.${EXTENSION_BUNDLE_VERSION_V2}_linux-x64.zip && \
wget https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/$EXTENSION_BUNDLE_VERSION_V2/$EXTENSION_BUNDLE_FILENAME_V2 && \
Expand All @@ -40,35 +32,3 @@ RUN EXTENSION_BUNDLE_VERSION=1.8.1 && \
find /FuncExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/$EXTENSION_BUNDLE_VERSION_V3/bin/runtimes/ -mindepth 1 -type d -not -name "linux-x64" -prune -exec rm -rf {} + && \
find /FuncExtensionBundles/ -type f -exec chmod 644 {} \;

FROM mcr.microsoft.com/java/jre-headless:${JAVA_VERSION}-zulu-debian10-with-tools as jre
FROM mcr.microsoft.com/dotnet/nightly/runtime-deps:6.0.0
ARG HOST_VERSION

EXPOSE 2222 80

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
HOME=/home \
FUNCTIONS_WORKER_RUNTIME=java \
DOTNET_USE_POLLING_FILE_WATCHER=true \
HOST_VERSION=${HOST_VERSION}

# Fix from https://github.com/GoogleCloudPlatform/google-cloud-dotnet-powerpack/issues/22#issuecomment-729895157
RUN apt-get update && \
apt-get install -y libc-dev

COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ]
COPY --from=runtime-image [ "/workers/java", "/azure-functions-host/workers/java" ]
COPY --from=jre [ "/usr/lib/jvm/zre-hl-8-azure-amd64", "/usr/lib/jvm/zre-8-azure-amd64" ]
COPY sshd_config /etc/ssh/
COPY start.sh /azure-functions-host/
COPY --from=runtime-image [ "/FuncExtensionBundles", "/FuncExtensionBundles" ]

ENV JAVA_HOME /usr/lib/jvm/zre-8-azure-amd64

RUN apt-get update && \
apt-get install -y --no-install-recommends openssh-server dialog && \
echo "root:Docker!" | chpasswd

RUN chmod +x /azure-functions-host/start.sh

ENTRYPOINT ["/azure-functions-host/start.sh"]
15 changes: 15 additions & 0 deletions host/4/bullseye/amd64/base/sharedconfig/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
Loading

0 comments on commit 485c0ef

Please sign in to comment.