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

Commit

Permalink
Merge pull request #23 from Microsoft/clantz/azure-fn-revamp
Browse files Browse the repository at this point in the history
Revamp Azure Functions Dev Container Definitions
  • Loading branch information
Chuxel committed Apr 28, 2019
2 parents 58d06c4 + bdba742 commit 2771ba0
Show file tree
Hide file tree
Showing 26 changed files with 156 additions and 652 deletions.
24 changes: 18 additions & 6 deletions containers/azure-functions-dotnetcore-2.1/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,30 @@

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

# Install git, process tools, bash
RUN apt-get update && apt-get -y install git procps
# Configure apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1

# Verify git and needed tools are installed
RUN apt-get -y install \
git \
procps \
curl \
apt-transport-https \
gnupg2 \
lsb-release

# Install Azure Functions and Azure CLI
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& 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 \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
&& apt-get update \
&& apt-get install -y azure-cli azure-functions-core-tools

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=dialog

23 changes: 23 additions & 0 deletions containers/azure-functions-dotnetcore-2.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ This definition requires an Azure subscription to use. You can create a [free ac

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

## Testing the definition

This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

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.
2. Clone this repository.
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4. Select the `containers/azure-functions-dotnetcore-2.1` folder.
5. After the folder has opened in the container, press <kbd>F1</kbd> and select **Azure Functions: Create Function...**.
6. Enter these options:
1. Yes (when prompted to create a new project)
2. C#
3. HTTP Trigger
4. HttpTriggerCSharp
5. Anonymous
6. Open in current window
7. After the files are added, in a moment you will see a notification to restore packages. Click "Restore".
8. After the restore has completed, press <kbd>F5</kbd> to start debugging project.
9. After the debugger is started, open a local browser and enter the URL: `http://localhost:7071/api/HttpTriggerCSharp?name=remote`.
- If the port 7071 is not already open, press <kbd>F1</kbd>, select **Remote-Containers: Forward Port from Container...**, and then port 7071.
10. You should see "Hello, remote" echoed by the Azure Function.
11. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.

## License

Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,29 @@

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

# Install git, process tools, bash
RUN apt-get update && apt-get -y install git procps
# Configure apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1

# Verify git and needed tools are installed
RUN apt-get -y install \
git \
procps \
curl \
apt-transport-https \
gnupg2 \
lsb-release

# Install Azure Functions and Azure CLI
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& 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 \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
&& apt-get update \
&& apt-get install -y azure-cli azure-functions-core-tools

# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=dialog
23 changes: 23 additions & 0 deletions containers/azure-functions-dotnetcore-latest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ This definition requires an Azure subscription to use. You can create a [free ac

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

## Testing the definition

This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

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.
2. Clone this repository.
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4. Select the `containers/azure-functions-dotnetcore-latest` folder.
5. After the folder has opened in the container, press <kbd>F1</kbd> and select **Azure Functions: Create Function...**.
6. Enter these options:
1. Yes (when prompted to create a new project)
2. C#
3. HTTP Trigger
4. HttpTriggerCSharp
5. Anonymous
6. Open in current window
7. After the files are added, in a moment you will see a notification to restore packages. Click "Restore".
8. After the restore has completed, press <kbd>F5</kbd> to start debugging project.
9. After the debugger is started, open a local browser and enter the URL: `http://localhost:7071/api/HttpTriggerCSharp?name=remote`.
- If the port 7071 is not already open, press <kbd>F1</kbd>, select **Remote-Containers: Forward Port from Container...**, and then port 7071.
10. You should see "Hello, remote" echoed by the Azure Function.
11. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.

## License

Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
42 changes: 3 additions & 39 deletions containers/azure-functions-java-8/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,12 @@ RUN apt-get -y install \
gnupg2 \
lsb-release

# Install dotnet core sdk - See https://github.com/dotnet/dotnet-docker/blob/master/2.1/sdk/stretch/amd64/Dockerfile
# Install .NET CLI dependencies
RUN apt-get install -y --no-install-recommends \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu57 \
liblttng-ust0 \
libssl1.0.2 \
libstdc++6 \
zlib1g

# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.1.603

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 \
&& dotnet_sha512='dd0efb8aae75d8f48ef3abbeca38ae14d2621a47e37b2d9d74755b58f9173343305f1a62cfa9a03f17c42f58b1d1b653d271e7d1327c81ff4af0a54c43c7db59' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

# Configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
# Enable correct mode for dotnet watch (only mode supported in a container)
DOTNET_USE_POLLING_FILE_WATCHER=true \
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
NUGET_XMLDOC_MODE=skip

# Trigger first run experience by running arbitrary cmd to populate local package cache
RUN dotnet help &> /dev/null


# Install Azure Functions and Azure CLI
# Install Azure Functions, .NET Core, and Azure CLI
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& 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 \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \
&& apt-get update \
&& apt-get install -y azure-cli azure-functions-core-tools
&& apt-get install -y azure-cli dotnet-sdk-2.1 azure-functions-core-tools

# Clean up
RUN apt-get autoremove -y \
Expand Down
6 changes: 0 additions & 6 deletions containers/azure-functions-java-8/.vscode/extensions.json

This file was deleted.

13 changes: 0 additions & 13 deletions containers/azure-functions-java-8/.vscode/launch.json

This file was deleted.

7 changes: 0 additions & 7 deletions containers/azure-functions-java-8/.vscode/settings.json

This file was deleted.

20 changes: 0 additions & 20 deletions containers/azure-functions-java-8/.vscode/tasks.json

This file was deleted.

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

## License

Expand Down
44 changes: 0 additions & 44 deletions containers/azure-functions-java-8/test-project/.classpath

This file was deleted.

35 changes: 0 additions & 35 deletions containers/azure-functions-java-8/test-project/.gitignore

This file was deleted.

23 changes: 0 additions & 23 deletions containers/azure-functions-java-8/test-project/.project

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions containers/azure-functions-java-8/test-project/host.json

This file was deleted.

Loading

0 comments on commit 2771ba0

Please sign in to comment.