I've tried a lot of Dockerfile samples to build my golang app, they're working fine running on local.
Here is the last one Dockerfile I tried
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.
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.
Reference link:
Make sure your files have been posted to the scm website. After under wwwroot, use the startup command to start your application.
go run main.go
Reference link:
Step by step guide to deploy Golang Application on Azure Web App
I modified the port listening to 80 (App service default WEBSITE_PORT)
add ENV to Dockerfile
ENV GOOS=linux GOARCH=amd64
Change Entrypoint
ENTRYPOINT [/app/app]
finally works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.