[英]Unable to deploy golang app to Azure app services container
I've tried a lot of Dockerfile samples to build my golang app, they're working fine running on local.我已经尝试了很多 Dockerfile 示例来构建我的 golang 应用程序,它们在本地运行良好。
Here is the last one Dockerfile I tried这是我试过的最后一个 Dockerfile
FROM golang:alpine
EXPOSE 80
RUN mkdir -p /app
WORKDIR /app
COPY . .
RUN go mod download
RUN go build -o app
ENTRYPOINT ["./app"]
I push my image to my Azure Container registry and use it via App service(linux) Deployment Center.我将我的图像推送到我的 Azure 容器注册表并通过应用服务(linux)部署中心使用它。
errors I got:我得到的错误:
You can try to solve your problem in the following two ways.您可以尝试通过以下两种方式解决您的问题。
According to your screenshot, you can add a startup command to the dockerfile.根据您的屏幕截图,您可以向 dockerfile 添加启动命令。
Reference link:参考链接:
1. How To Deploy a Go Web Application with Docker 1. 如何使用 Docker 部署 Go Web 应用程序
2. Changing RUN to CMD stops the container from working 2. 将 RUN 更改为 CMD 会使容器停止工作
Make sure your files have been posted to the scm website.确保您的文件已发布到 scm 网站。 After under wwwroot, use the startup command to start your application.
在 wwwroot 下之后,使用启动命令启动您的应用程序。
go run main.go
Reference link:参考链接:
Step by step guide to deploy Golang Application on Azure Web App 在 Azure Web App 上部署 Golang 应用程序的分步指南
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.