Azure Container Apps
Let's deploy the Go API service
Create Docker Image
Create a Dockerfile in the root directory of your Go project, same level as where main.go file is located.
Overall Process: From Azure Portal
- Create an Azure Container Registry (ACR)
- Azure Container Registry (ACR)
- Azure Container App Get a public HTTPS endpoint of the application.
Permission needed for ACR and Azure Container App
- Container Registry Contributor +
- Container Registry Repository Catalog Lister +
- AcrPull+
- AcrPush+
# Use the official Golang image as the base image
FROM golang:1.22-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app
FROM gcr.io/distroless/base-debian12
WORKDIR /app
COPY --from=builder /app/app .
EXPOSE <PortNumber>
CMD ["./app"]