Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit 2771ba0

Browse files
authored
Merge pull request #23 from Microsoft/clantz/azure-fn-revamp
Revamp Azure Functions Dev Container Definitions
2 parents 58d06c4 + bdba742 commit 2771ba0

File tree

26 files changed

+156
-652
lines changed

26 files changed

+156
-652
lines changed

containers/azure-functions-dotnetcore-2.1/.devcontainer/Dockerfile

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,30 @@
55

66
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
77

8-
# Install git, process tools, bash
9-
RUN apt-get update && apt-get -y install git procps
8+
# Configure apt
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
RUN apt-get update \
11+
&& apt-get -y install --no-install-recommends apt-utils 2>&1
12+
13+
# Verify git and needed tools are installed
14+
RUN apt-get -y install \
15+
git \
16+
procps \
17+
curl \
18+
apt-transport-https \
19+
gnupg2 \
20+
lsb-release
1021

1122
# Install Azure Functions and Azure CLI
12-
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
13-
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
23+
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
1424
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
15-
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
25+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
1626
&& apt-get update \
1727
&& apt-get install -y azure-cli azure-functions-core-tools
18-
28+
1929
# Clean up
2030
RUN apt-get autoremove -y \
2131
&& apt-get clean -y \
2232
&& rm -rf /var/lib/apt/lists/*
33+
ENV DEBIAN_FRONTEND=dialog
34+

containers/azure-functions-dotnetcore-2.1/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@ This definition requires an Azure subscription to use. You can create a [free ac
3030

3131
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
3232

33+
## Testing the definition
34+
35+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
36+
37+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
38+
2. Clone this repository.
39+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
40+
4. Select the `containers/azure-functions-dotnetcore-2.1` folder.
41+
5. After the folder has opened in the container, press <kbd>F1</kbd> and select **Azure Functions: Create Function...**.
42+
6. Enter these options:
43+
1. Yes (when prompted to create a new project)
44+
2. C#
45+
3. HTTP Trigger
46+
4. HttpTriggerCSharp
47+
5. Anonymous
48+
6. Open in current window
49+
7. After the files are added, in a moment you will see a notification to restore packages. Click "Restore".
50+
8. After the restore has completed, press <kbd>F5</kbd> to start debugging project.
51+
9. After the debugger is started, open a local browser and enter the URL: `http://localhost:7071/api/HttpTriggerCSharp?name=remote`.
52+
- If the port 7071 is not already open, press <kbd>F1</kbd>, select **Remote-Containers: Forward Port from Container...**, and then port 7071.
53+
10. You should see "Hello, remote" echoed by the Azure Function.
54+
11. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
55+
3356
## License
3457

3558
Copyright (c) Microsoft Corporation. All rights reserved.

containers/azure-functions-dotnetcore-latest/.devcontainer/Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,29 @@
55

66
FROM mcr.microsoft.com/dotnet/core/sdk:latest
77

8-
# Install git, process tools, bash
9-
RUN apt-get update && apt-get -y install git procps
8+
# Configure apt
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
RUN apt-get update \
11+
&& apt-get -y install --no-install-recommends apt-utils 2>&1
12+
13+
# Verify git and needed tools are installed
14+
RUN apt-get -y install \
15+
git \
16+
procps \
17+
curl \
18+
apt-transport-https \
19+
gnupg2 \
20+
lsb-release
1021

1122
# Install Azure Functions and Azure CLI
12-
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
13-
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
23+
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
1424
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
15-
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
25+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
1626
&& apt-get update \
1727
&& apt-get install -y azure-cli azure-functions-core-tools
1828

1929
# Clean up
2030
RUN apt-get autoremove -y \
2131
&& apt-get clean -y \
2232
&& rm -rf /var/lib/apt/lists/*
33+
ENV DEBIAN_FRONTEND=dialog

containers/azure-functions-dotnetcore-latest/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@ This definition requires an Azure subscription to use. You can create a [free ac
3030

3131
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
3232

33+
## Testing the definition
34+
35+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
36+
37+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
38+
2. Clone this repository.
39+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
40+
4. Select the `containers/azure-functions-dotnetcore-latest` folder.
41+
5. After the folder has opened in the container, press <kbd>F1</kbd> and select **Azure Functions: Create Function...**.
42+
6. Enter these options:
43+
1. Yes (when prompted to create a new project)
44+
2. C#
45+
3. HTTP Trigger
46+
4. HttpTriggerCSharp
47+
5. Anonymous
48+
6. Open in current window
49+
7. After the files are added, in a moment you will see a notification to restore packages. Click "Restore".
50+
8. After the restore has completed, press <kbd>F5</kbd> to start debugging project.
51+
9. After the debugger is started, open a local browser and enter the URL: `http://localhost:7071/api/HttpTriggerCSharp?name=remote`.
52+
- If the port 7071 is not already open, press <kbd>F1</kbd>, select **Remote-Containers: Forward Port from Container...**, and then port 7071.
53+
10. You should see "Hello, remote" echoed by the Azure Function.
54+
11. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
55+
3356
## License
3457

3558
Copyright (c) Microsoft Corporation. All rights reserved.

containers/azure-functions-java-8/.devcontainer/Dockerfile

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,12 @@ RUN apt-get -y install \
2222
gnupg2 \
2323
lsb-release
2424

25-
# Install dotnet core sdk - See https://github.com/dotnet/dotnet-docker/blob/master/2.1/sdk/stretch/amd64/Dockerfile
26-
# Install .NET CLI dependencies
27-
RUN apt-get install -y --no-install-recommends \
28-
libc6 \
29-
libgcc1 \
30-
libgssapi-krb5-2 \
31-
libicu57 \
32-
liblttng-ust0 \
33-
libssl1.0.2 \
34-
libstdc++6 \
35-
zlib1g
36-
37-
# Install .NET Core SDK
38-
ENV DOTNET_SDK_VERSION 2.1.603
39-
40-
RUN curl -SL --output dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
41-
&& dotnet_sha512='dd0efb8aae75d8f48ef3abbeca38ae14d2621a47e37b2d9d74755b58f9173343305f1a62cfa9a03f17c42f58b1d1b653d271e7d1327c81ff4af0a54c43c7db59' \
42-
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
43-
&& mkdir -p /usr/share/dotnet \
44-
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
45-
&& rm dotnet.tar.gz \
46-
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
47-
48-
# Configure web servers to bind to port 80 when present
49-
ENV ASPNETCORE_URLS=http://+:80 \
50-
# Enable detection of running in a container
51-
DOTNET_RUNNING_IN_CONTAINER=true \
52-
# Enable correct mode for dotnet watch (only mode supported in a container)
53-
DOTNET_USE_POLLING_FILE_WATCHER=true \
54-
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
55-
NUGET_XMLDOC_MODE=skip
56-
57-
# Trigger first run experience by running arbitrary cmd to populate local package cache
58-
RUN dotnet help &> /dev/null
59-
60-
61-
# Install Azure Functions and Azure CLI
25+
# Install Azure Functions, .NET Core, and Azure CLI
6226
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
6327
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
64-
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
28+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
6529
&& apt-get update \
66-
&& apt-get install -y azure-cli azure-functions-core-tools
30+
&& apt-get install -y azure-cli dotnet-sdk-2.1 azure-functions-core-tools
6731

6832
# Clean up
6933
RUN apt-get autoremove -y \

containers/azure-functions-java-8/.vscode/extensions.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

containers/azure-functions-java-8/.vscode/launch.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

containers/azure-functions-java-8/.vscode/settings.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

containers/azure-functions-java-8/.vscode/tasks.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

containers/azure-functions-java-8/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,19 @@ This definition includes some test code that will help you verify it is working
3838
2. Clone this repository.
3939
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4040
4. Select the `containers/azure-functions-java-8` folder.
41-
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project.
42-
6. After the debugger is started, type `curl http://localhost:7071/api/HttpTrigger-Java?name=test` in the terminal, you should see "Hello, test" echoed by the Azure Function.
43-
7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
41+
5. After the folder has opened in the container, press <kbd>F1</kbd> and select **Azure Functions: Create Function...**.
42+
6. Enter these options:
43+
1. Yes (when prompted to create a new project)
44+
2. Java
45+
3. HTTP Trigger
46+
4. HTTPTrigger-Java
47+
5. Anonymous
48+
6. Open in current window
49+
7. Press <kbd>F5</kbd> to start debugging project.
50+
8. After the debugger is started, open a local browser and enter the URL: `http://localhost:7071/api/HttpTrigger-Java?name=remote`.
51+
- If the port 7071 is not already open, press <kbd>F1</kbd>, select **Remote-Containers: Forward Port from Container...**, and then port 7071.
52+
9. You should see "Hello, remote" echoed by the Azure Function.
53+
10. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
4454

4555
## License
4656

0 commit comments

Comments
 (0)