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

+2-2
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

+22-13
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

+1-3
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

+2-2
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

+1-2
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 src/Azure.Functions.Cli/StaticResources/Dockerfile.java11

+3-3
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
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 src/Azure.Functions.Cli/StaticResources/Dockerfile.node14

+2-2
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 src/Azure.Functions.Cli/StaticResources/Dockerfile.powershell7

+2-2
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

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# To enable ssh & remote debugging on app service change the base image to the one below
2+
# FROM mcr.microsoft.com/azure-functions/powershell:4-powershell7.2-appservice
3+
FROM mcr.microsoft.com/azure-functions/powershell:4-powershell7.2
4+
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
5+
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
6+
7+
COPY . /home/site/wwwroot

src/Azure.Functions.Cli/StaticResources/Dockerfile.python37 src/Azure.Functions.Cli/StaticResources/Dockerfile.python3.7

+2-2
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/python:3.0-python3.7-appservice
3-
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.7
2+
# FROM mcr.microsoft.com/azure-functions/python:4-python3.7-appservice
3+
FROM mcr.microsoft.com/azure-functions/python:4-python3.7
44

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

src/Azure.Functions.Cli/StaticResources/Dockerfile.python39 src/Azure.Functions.Cli/StaticResources/Dockerfile.python3.8

+2-2
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/python:3.0-python3.9-appservice
3-
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.9
2+
# FROM mcr.microsoft.com/azure-functions/python:4-python3.8-appservice
3+
FROM mcr.microsoft.com/azure-functions/python:4-python3.8
44

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

src/Azure.Functions.Cli/StaticResources/Dockerfile.python38 src/Azure.Functions.Cli/StaticResources/Dockerfile.python3.9

+2-2
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/python:3.0-python3.8-appservice
3-
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8
2+
# FROM mcr.microsoft.com/azure-functions/python:4-python3.9-appservice
3+
FROM mcr.microsoft.com/azure-functions/python:4-python3.9
44

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

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

+2-2
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-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

src/Azure.Functions.Cli/StaticResources/StaticResources.cs

+12-6
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,23 @@ private static async Task<string> GetValue(string name)
3737

3838
public static Task<string> DockerfileDotnetIsolated => GetValue("Dockerfile.dotnetIsolated");
3939

40-
public static Task<string> DockerfilePython36 => GetValue("Dockerfile.python36");
40+
public static Task<string> DockerfileJava8 => GetValue("Dockerfile.java8");
4141

42-
public static Task<string> DockerfilePython37 => GetValue("Dockerfile.python37");
42+
public static Task<string> DockerfileJava11 => GetValue("Dockerfile.java11");
4343

44-
public static Task<string> DockerfilePython38 => GetValue("Dockerfile.python38");
44+
public static Task<string> DockerfilePython37 => GetValue("Dockerfile.python3.7");
4545

46-
public static Task<string> DockerfilePython39 => GetValue("Dockerfile.python39");
46+
public static Task<string> DockerfilePython38 => GetValue("Dockerfile.python3.8");
4747

48-
public static Task<string> DockerfilePowershell => GetValue("Dockerfile.powershell");
48+
public static Task<string> DockerfilePython39 => GetValue("Dockerfile.python3.9");
4949

50-
public static Task<string> DockerfileNode => GetValue("Dockerfile.node");
50+
public static Task<string> DockerfilePowershell7 => GetValue("Dockerfile.powershell7");
51+
52+
public static Task<string> DockerfilePowershell72 => GetValue("Dockerfile.powershell7.2");
53+
54+
public static Task<string> DockerfileNode14 => GetValue("Dockerfile.node14");
55+
56+
public static Task<string> DockerfileNode16 => GetValue("Dockerfile.node16");
5157

5258
public static Task<string> DockerfileTypescript => GetValue("Dockerfile.typescript");
5359

test/Azure.Functions.Cli.Tests/E2E/InitTests.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ public Task init_with_no_source_control()
159159

160160
[Theory]
161161
[InlineData("dotnet", "4")]
162-
[InlineData("node", "3.0")]
163-
[InlineData("powershell", "3.0")]
162+
[InlineData("node", "4")]
163+
[InlineData("powershell", "4")]
164164
public Task init_with_Dockerfile(string workerRuntime, string version)
165165
{
166166
return CliTester.Run(new RunConfiguration
@@ -192,7 +192,7 @@ await CliTester.Run(new RunConfiguration
192192
new FileResult
193193
{
194194
Name = "Dockerfile",
195-
ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/python:3.0-python{worker.Major}.{worker.Minor}" }
195+
ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/python:4-python{worker.Major}.{worker.Minor}" }
196196
}
197197
},
198198
OutputContains = new[] { "Dockerfile" }
@@ -229,7 +229,7 @@ public Task init_with_Dockerfile_for_csx()
229229
{
230230
Name = "Dockerfile",
231231
ContentNotContains = new[] { "dotnet publish" },
232-
ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet:3.0" }
232+
ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet:4" }
233233
}
234234
},
235235
OutputContains = new[] { "Dockerfile" }
@@ -302,7 +302,7 @@ public Task init_ts_app_using_lang(string initCommand)
302302
Name = "Dockerfile",
303303
ContentContains = new []
304304
{
305-
"mcr.microsoft.com/azure-functions/node:3.0",
305+
"mcr.microsoft.com/azure-functions/node:4",
306306
"npm run build"
307307
}
308308
}
@@ -384,8 +384,8 @@ public Task init_ts_app_using_runtime()
384384

385385
[Theory]
386386
[InlineData("dotnet", "4")]
387-
[InlineData("node", "3.0")]
388-
[InlineData("powershell", "3.0")]
387+
[InlineData("node", "4")]
388+
[InlineData("powershell", "4")]
389389
public Task init_docker_only_for_existing_project(string workerRuntime, string version)
390390
{
391391
return CliTester.Run(new RunConfiguration
@@ -423,7 +423,7 @@ public Task init_docker_only_for_csx_project()
423423
{
424424
Name = "Dockerfile",
425425
ContentNotContains = new[] { "dotnet publish" },
426-
ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet:3.0" }
426+
ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet:4" }
427427
}
428428
},
429429
OutputContains = new[] { "Dockerfile" }

0 commit comments

Comments
 (0)