diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 1adf5f3..dba2254 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -13,6 +13,7 @@ jobs: with: filters: | azure-functions-dotnet: ./**/azure-functions-dotnet/** + azure-functions-go: ./**/azure-functions-go/** azure-functions-java: ./**/azure-functions-java/** azure-functions-node: ./**/azure-functions-node/** azure-functions-powershell: ./**/azure-functions-powershell/** diff --git a/README.md b/README.md index d031997..c270e16 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ A collection of [Dev Container Templates](https://containers.dev/implementors/te | Template | Languages / Runtimes | Supported Versions | | --- | --- | --- | | [Azure Functions (.NET)](./src/azure-functions-dotnet) | C#, .NET | 8.0 / 9.0 / 10.0 | +| [Azure Functions (Go)](./src/azure-functions-go) | Go | 1.24 / 1.25 / 1.26 | | [Azure Functions (Java)](./src/azure-functions-java) | Java | 8 / 11 / 17 / 21 / 25 | | [Azure Functions (Node.js)](./src/azure-functions-node) | JavaScript, TypeScript | 20 / 22 / 24 | | [Azure Functions (PowerShell)](./src/azure-functions-powershell) | PowerShell | 7.4 / 7.6 | diff --git a/src/azure-functions-go/.devcontainer/Dockerfile b/src/azure-functions-go/.devcontainer/Dockerfile new file mode 100644 index 0000000..2d66776 --- /dev/null +++ b/src/azure-functions-go/.devcontainer/Dockerfile @@ -0,0 +1 @@ +FROM mcr.microsoft.com/devcontainers/base:noble diff --git a/src/azure-functions-go/.devcontainer/devcontainer.json b/src/azure-functions-go/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0910767 --- /dev/null +++ b/src/azure-functions-go/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +{ + "name": "Azure Functions (Go)", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "forwardPorts": [ + 7071, + 10000, + 10001, + 10002 + ], + "otherPortsAttributes": { + "onAutoForward": "ignore" + }, + "features": { + "ghcr.io/devcontainers/features/go:1": { + "version": "${templateOption:goVersion}" + }, + "ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": { + "version": "${templateOption:azureFunctionsCliVersion}" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-azurefunctions", + "golang.go" + ] + } + } +} diff --git a/src/azure-functions-go/.devcontainer/docker-compose.yml b/src/azure-functions-go/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..adae90a --- /dev/null +++ b/src/azure-functions-go/.devcontainer/docker-compose.yml @@ -0,0 +1,13 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + volumes: + - ../..:/workspaces:cached + command: sleep infinity + network_mode: service:azurite + + azurite: + image: mcr.microsoft.com/azure-storage/azurite + restart: unless-stopped diff --git a/src/azure-functions-go/.github/dependabot.yml b/src/azure-functions-go/.github/dependabot.yml new file mode 100644 index 0000000..f33a02c --- /dev/null +++ b/src/azure-functions-go/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/src/azure-functions-go/devcontainer-template.json b/src/azure-functions-go/devcontainer-template.json new file mode 100644 index 0000000..dfb97aa --- /dev/null +++ b/src/azure-functions-go/devcontainer-template.json @@ -0,0 +1,37 @@ +{ + "id": "azure-functions-go", + "version": "1.0.0", + "name": "Azure Functions (Go)", + "description": "Develop Go based Azure Functions. Includes all needed SDKs, extensions, and dependencies.", + "documentationURL": "https://github.com/shibayan/devcontainers/tree/master/src/azure-functions-go", + "publisher": "shibayan", + "licenseURL": "https://github.com/shibayan/devcontainers/blob/master/LICENSE", + "options": { + "goVersion": { + "type": "string", + "description": "Go version:", + "proposals": [ + "1.26", + "1.25", + "1.24" + ], + "default": "1.24" + }, + "azureFunctionsCliVersion": { + "type": "string", + "description": "Azure Functions CLI version:", + "proposals": [ + "latest", + "4.12.0" + ], + "default": "latest" + } + }, + "platforms": [ + "Azure Functions", + "Go" + ], + "optionalPaths": [ + ".github/*" + ] +} diff --git a/test/azure-functions-go/test.sh b/test/azure-functions-go/test.sh new file mode 100644 index 0000000..3ba59bc --- /dev/null +++ b/test/azure-functions-go/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +cd "$(dirname "$0")" +bash run-template-checks.sh "go" go version