Ubuntu 24.04 with Go 1.23.4 and Azure Speech SDK pre-installed. Multi-arch support (amd64/arm64).
7.3K
一个预装了 Go 1.23.4 和 Azure Speech SDK 的基础 Docker 镜像,基于 Ubuntu 24.04 构建,专为开发 Azure 语音服务的 Go 应用程序而设计。
✨ 特性
docker pull difyz9/azure-go:latest
docker run -it difyz9/azure-go:latest bash
FROM difyz9/azure-go:latest
WORKDIR /app
COPY . .
RUN go mod download
RUN go build -o myapp
CMD ["./myapp"]
/opt/speechsdkCGO_CFLAGS="-I/opt/speechsdk/include/c_api"
CGO_LDFLAGS="-L/opt/speechsdk/lib/x64 -lMicrosoft.CognitiveServices.Speech.core"
LD_LIBRARY_PATH="/opt/speechsdk/lib/x64:/usr/local/lib"
package main
import (
"fmt"
"github.com/Microsoft/cognitive-services-speech-sdk-go/audio"
"github.com/Microsoft/cognitive-services-speech-sdk-go/speech"
)
func main() {
// 配置 Speech SDK
config, err := speech.NewSpeechConfigFromSubscription("YourSubscriptionKey", "YourRegion")
if err != nil {
panic(err)
}
defer config.Close()
config.SetSpeechSynthesisLanguage("zh-CN")
config.SetSpeechSynthesisVoiceName("zh-CN-XiaoxiaoNeural")
// 创建音频配置
audioConfig, err := audio.NewAudioConfigFromDefaultSpeakerOutput()
if err != nil {
panic(err)
}
defer audioConfig.Close()
// 创建语音合成器
synthesizer, err := speech.NewSpeechSynthesizerFromConfig(config, audioConfig)
if err != nil {
panic(err)
}
defer synthesizer.Close()
// 合成语音
text := "你好,这是 Azure 语音服务测试"
result := <-synthesizer.SpeakTextAsync(text)
if result.Reason == speech.SynthesizingAudioCompleted {
fmt.Println("语音合成成功!")
} else {
fmt.Printf("合成失败: %v\n", result.Reason)
}
}
package main
import (
"fmt"
"github.com/Microsoft/cognitive-services-speech-sdk-go/audio"
"github.com/Microsoft/cognitive-services-speech-sdk-go/speech"
)
func main() {
config, err := speech.NewSpeechConfigFromSubscription("YourSubscriptionKey", "YourRegion")
if err != nil {
panic(err)
}
defer config.Close()
config.SetSpeechRecognitionLanguage("zh-CN")
audioConfig, err := audio.NewAudioConfigFromDefaultMicrophoneInput()
if err != nil {
panic(err)
}
defer audioConfig.Close()
recognizer, err := speech.NewSpeechRecognizerFromConfig(config, audioConfig)
if err != nil {
panic(err)
}
defer recognizer.Close()
fmt.Println("请说话...")
result := <-recognizer.RecognizeOnceAsync()
if result.Reason == speech.RecognizedSpeech {
fmt.Printf("识别结果: %s\n", result.Text)
}
}
| 标签 | 描述 |
|---|---|
latest | 最新版本 |
go1.23.4 | 指定 Go 版本 |
YYYYMMDD | 按日期构建的版本 |
本镜像支持以下架构,自动检测并下载对应架构的 Go 版本:
linux/amd64 - x86-64 架构linux/arm64 - ARM64 架构(Apple Silicon、AWS Graviton 等)dpkg --print-architecture 自动检测容器架构cgo/gcc -m64 错误镜像每周自动构建一次,确保包含最新的安全更新。
镜像版本遵循语义化版本规范:v<major>.<minor>.<patch>
使用此镜像开发 Azure 语音服务应用需要:
eastasia, westus, westeurope 等本镜像基于以下开源软件构建:
欢迎提交 Issue 和 Pull Request!
如遇到问题,请在 GitHub 仓库提交 Issue。
注意: 使用 Azure 语音服务可能会产生费用,请参考 Azure 定价。
Content type
Image
Digest
sha256:0b193bdba…
Size
223.1 MB
Last updated
1 day ago
docker pull difyz9/azure-go