Skip to content

Commit

Permalink
Updating the docker files. (#3359)
Browse files Browse the repository at this point in the history
  • Loading branch information
khkh-ms authored May 10, 2023
1 parent f032367 commit 623c085
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Azure.Functions.Cli/Actions/LocalActions/InitAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ private static async Task WriteDockerfile(WorkerRuntime workerRuntime, string la
{
if (language == Constants.Languages.TypeScript)
{
await FileSystemHelpers.WriteFileIfNotExists("Dockerfile", await StaticResources.DockerfileTypescript);
await FileSystemHelpers.WriteFileIfNotExists("Dockerfile", await StaticResources.DockerfileTypescriptNode18);
}
else
{
await FileSystemHelpers.WriteFileIfNotExists("Dockerfile", await StaticResources.DockerfileNode16);
await FileSystemHelpers.WriteFileIfNotExists("Dockerfile", await StaticResources.DockerfileNode18);
}
}
else if (workerRuntime == Helpers.WorkerRuntime.python)
Expand Down
6 changes: 6 additions & 0 deletions src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
<EmbeddedResource Include="StaticResources\Dockerfile.typescript">
<LogicalName>$(AssemblyName).Dockerfile.typescript</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="StaticResources\Dockerfile.node18">
<LogicalName>$(AssemblyName).Dockerfile.node18</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="StaticResources\Dockerfile.typescript.node18">
<LogicalName>$(AssemblyName).Dockerfile.typescript.node18</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="StaticResources\gitignore">
<LogicalName>$(AssemblyName).gitignore</LogicalName>
</EmbeddedResource>
Expand Down
3 changes: 0 additions & 3 deletions src/Azure.Functions.Cli/StaticResources/Dockerfile.dotnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS installer-env

# Build requires 3.1 SDK
COPY --from=mcr.microsoft.com/dotnet/core/sdk:3.1 /usr/share/dotnet /usr/share/dotnet

COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
mkdir -p /home/site/wwwroot && \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS installer-env

# Build requires 3.1 SDK
COPY --from=mcr.microsoft.com/dotnet/core/sdk:3.1 /usr/share/dotnet /usr/share/dotnet

COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
mkdir -p /home/site/wwwroot && \
Expand Down
11 changes: 11 additions & 0 deletions src/Azure.Functions.Cli/StaticResources/Dockerfile.node18
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/node:4-node18-appservice
FROM mcr.microsoft.com/azure-functions/node:4-node18

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

COPY . /home/site/wwwroot

RUN cd /home/site/wwwroot && \
npm install
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/node:4-node18-appservice
FROM mcr.microsoft.com/azure-functions/node:4-node18

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

COPY . /home/site/wwwroot

RUN cd /home/site/wwwroot && \
npm install && \
npm run build
4 changes: 4 additions & 0 deletions src/Azure.Functions.Cli/StaticResources/StaticResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ public static async Task<string> GetValue(string name)

public static Task<string> DockerfileNode16 => GetValue("Dockerfile.node16");

public static Task<string> DockerfileNode18 => GetValue("Dockerfile.node18");

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

public static Task<string> DockerfileTypescriptNode18 => GetValue("Dockerfile.typescript.node18");

public static Task<string> DockerIgnoreFile => GetValue("dockerignore");

public static Task<string> VsCodeExtensionsJson => GetValue("vscode.extensions.json");
Expand Down

0 comments on commit 623c085

Please sign in to comment.