Skip to content

Commit 587e44b

Browse files
Update docker images v4 (#3072)
* Update docker images for Functions V4 * Remove Python 3.6 Dockerfile and add Java Dockerfile to .csproj * Update Python 3.7 Dockerfile and add Java and PowerShell versions * Corrected expected output for InitTests
1 parent 1080324 commit 587e44b

17 files changed

+93
-56
lines changed

src/Azure.Functions.Cli/Actions/LocalActions/InitAction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private static async Task WriteDockerfile(WorkerRuntime workerRuntime, string la
342342
}
343343
else
344344
{
345-
await WriteFiles("Dockerfile", await StaticResources.DockerfileNode);
345+
await WriteFiles("Dockerfile", await StaticResources.DockerfileNode16);
346346
}
347347
}
348348
else if (workerRuntime == Helpers.WorkerRuntime.python)
@@ -351,7 +351,7 @@ private static async Task WriteDockerfile(WorkerRuntime workerRuntime, string la
351351
}
352352
else if (workerRuntime == Helpers.WorkerRuntime.powershell)
353353
{
354-
await WriteFiles("Dockerfile", await StaticResources.DockerfilePowershell);
354+
await WriteFiles("Dockerfile", await StaticResources.DockerfilePowershell7);
355355
}
356356
else if(workerRuntime == Helpers.WorkerRuntime.custom)
357357
{

src/Azure.Functions.Cli/Azure.Functions.Cli.csproj

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ExcludeWorkersFromReadyToRun">
1+
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ExcludeWorkersFromReadyToRun">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
44
<TargetFramework>net6.0</TargetFramework>
@@ -55,23 +55,32 @@
5555
<EmbeddedResource Include="StaticResources\Dockerfile.dotnetIsolated">
5656
<LogicalName>$(AssemblyName).Dockerfile.dotnetIsolated</LogicalName>
5757
</EmbeddedResource>
58-
<EmbeddedResource Include="StaticResources\Dockerfile.python36">
59-
<LogicalName>$(AssemblyName).Dockerfile.python36</LogicalName>
58+
<EmbeddedResource Include="StaticResources\Dockerfile.java8">
59+
<LogicalName>$(AssemblyName).Dockerfile.java8</LogicalName>
6060
</EmbeddedResource>
61-
<EmbeddedResource Include="StaticResources\Dockerfile.python37">
62-
<LogicalName>$(AssemblyName).Dockerfile.python37</LogicalName>
61+
<EmbeddedResource Include="StaticResources\Dockerfile.java11">
62+
<LogicalName>$(AssemblyName).Dockerfile.java11</LogicalName>
6363
</EmbeddedResource>
64-
<EmbeddedResource Include="StaticResources\Dockerfile.python38">
65-
<LogicalName>$(AssemblyName).Dockerfile.python38</LogicalName>
64+
<EmbeddedResource Include="StaticResources\Dockerfile.node14">
65+
<LogicalName>$(AssemblyName).Dockerfile.node14</LogicalName>
6666
</EmbeddedResource>
67-
<EmbeddedResource Include="StaticResources\Dockerfile.python39">
68-
<LogicalName>$(AssemblyName).Dockerfile.python39</LogicalName>
67+
<EmbeddedResource Include="StaticResources\Dockerfile.node16">
68+
<LogicalName>$(AssemblyName).Dockerfile.node16</LogicalName>
6969
</EmbeddedResource>
70-
<EmbeddedResource Include="StaticResources\Dockerfile.powershell">
71-
<LogicalName>$(AssemblyName).Dockerfile.powershell</LogicalName>
70+
<EmbeddedResource Include="StaticResources\Dockerfile.powershell7">
71+
<LogicalName>$(AssemblyName).Dockerfile.powershell7</LogicalName>
7272
</EmbeddedResource>
73-
<EmbeddedResource Include="StaticResources\Dockerfile.node">
74-
<LogicalName>$(AssemblyName).Dockerfile.node</LogicalName>
73+
<EmbeddedResource Include="StaticResources\Dockerfile.powershell7.2">
74+
<LogicalName>$(AssemblyName).Dockerfile.powershell7.2</LogicalName>
75+
</EmbeddedResource>
76+
<EmbeddedResource Include="StaticResources\Dockerfile.python3.7">
77+
<LogicalName>$(AssemblyName).Dockerfile.python3.7</LogicalName>
78+
</EmbeddedResource>
79+
<EmbeddedResource Include="StaticResources\Dockerfile.python3.8">
80+
<LogicalName>$(AssemblyName).Dockerfile.python3.8</LogicalName>
81+
</EmbeddedResource>
82+
<EmbeddedResource Include="StaticResources\Dockerfile.python3.9">
83+
<LogicalName>$(AssemblyName).Dockerfile.python3.9</LogicalName>
7584
</EmbeddedResource>
7685
<EmbeddedResource Include="StaticResources\Dockerfile.typescript">
7786
<LogicalName>$(AssemblyName).Dockerfile.typescript</LogicalName>

src/Azure.Functions.Cli/Helpers/PythonHelpers.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,6 @@ public static Task<string> GetDockerInitFileContent(WorkerLanguageVersionInfo in
491491
{
492492
switch (info?.Minor)
493493
{
494-
case 6:
495-
return StaticResources.DockerfilePython36;
496494
case 7:
497495
return StaticResources.DockerfilePython37;
498496
case 8:
@@ -501,7 +499,7 @@ public static Task<string> GetDockerInitFileContent(WorkerLanguageVersionInfo in
501499
return StaticResources.DockerfilePython39;
502500
}
503501
}
504-
return StaticResources.DockerfilePython36;
502+
return StaticResources.DockerfilePython37;
505503
}
506504

507505
private static string GetBuildNativeDepsEnvironmentImage(WorkerLanguageVersionInfo info)

src/Azure.Functions.Cli/StaticResources/Dockerfile.csx.dotnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# To enable ssh & remote debugging on app service change the base image to the one below
2-
# FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice
3-
FROM mcr.microsoft.com/azure-functions/dotnet:3.0
2+
# FROM mcr.microsoft.com/azure-functions/dotnet:4-appservice
3+
FROM mcr.microsoft.com/azure-functions/dotnet:4
44
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
55
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
66

src/Azure.Functions.Cli/StaticResources/Dockerfile.custom

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# To enable ssh & remote debugging on app service change the base image to the one below
2-
FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice
1+
FROM mcr.microsoft.com/azure-functions/dotnet:4-appservice
32
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
43
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
54

src/Azure.Functions.Cli/StaticResources/Dockerfile.java renamed to src/Azure.Functions.Cli/StaticResources/Dockerfile.java11

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/azure-functions/java:3.0-java8-build AS installer-env
1+
FROM mcr.microsoft.com/azure-functions/java:4-java11-build AS installer-env
22

33
COPY . /src/java-function-app
44
RUN cd /src/java-function-app && \
@@ -9,8 +9,8 @@
99
cp -a . /home/site/wwwroot
1010

1111
# To enable ssh & remote debugging on app service change the base image to the one below
12-
# FROM mcr.microsoft.com/azure-functions/java:3.0-java8-appservice
13-
FROM mcr.microsoft.com/azure-functions/java:3.0-java8
12+
# FROM mcr.microsoft.com/azure-functions/java:4-java11-appservice
13+
FROM mcr.microsoft.com/azure-functions/java:4-java11
1414

1515
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
1616
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM mcr.microsoft.com/azure-functions/java:4-java8-build AS installer-env
2+
3+
COPY . /src/java-function-app
4+
RUN cd /src/java-function-app && \
5+
mkdir -p /home/site/wwwroot && \
6+
mvn clean package && \
7+
cd ./target/azure-functions/ && \
8+
cd $(ls -d */|head -n 1) && \
9+
cp -a . /home/site/wwwroot
10+
11+
# To enable ssh & remote debugging on app service change the base image to the one below
12+
# FROM mcr.microsoft.com/azure-functions/java:4-java8-appservice
13+
FROM mcr.microsoft.com/azure-functions/java:4-java8
14+
15+
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
16+
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
17+
18+
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]

src/Azure.Functions.Cli/StaticResources/Dockerfile.node renamed to src/Azure.Functions.Cli/StaticResources/Dockerfile.node14

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# To enable ssh & remote debugging on app service change the base image to the one below
2-
# FROM mcr.microsoft.com/azure-functions/node:3.0-appservice
3-
FROM mcr.microsoft.com/azure-functions/node:3.0
2+
# FROM mcr.microsoft.com/azure-functions/node:4-node14-appservice
3+
FROM mcr.microsoft.com/azure-functions/node:4-node14
44

55
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
66
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# To enable ssh & remote debugging on app service change the base image to the one below
2-
# FROM mcr.microsoft.com/azure-functions/python:3.0-python3.6-appservice
3-
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.6
2+
# FROM mcr.microsoft.com/azure-functions/node:4-node16-appservice
3+
FROM mcr.microsoft.com/azure-functions/node:4-node16
44

55
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
66
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
77

8-
COPY requirements.txt /
9-
RUN pip install -r /requirements.txt
10-
118
COPY . /home/site/wwwroot
9+
10+
RUN cd /home/site/wwwroot && \
11+
npm install

src/Azure.Functions.Cli/StaticResources/Dockerfile.powershell renamed to src/Azure.Functions.Cli/StaticResources/Dockerfile.powershell7

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# To enable ssh & remote debugging on app service change the base image to the one below
2-
# FROM mcr.microsoft.com/azure-functions/powershell:3.0-appservice
3-
FROM mcr.microsoft.com/azure-functions/powershell:3.0
2+
# FROM mcr.microsoft.com/azure-functions/powershell:4-powershell7-appservice
3+
FROM mcr.microsoft.com/azure-functions/powershell:4-powershell7
44
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
55
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
66

0 commit comments

Comments
 (0)