Files
doormile_backend/Dockerfile
2026-06-22 17:43:40 +05:30

22 lines
477 B
Docker

# First Stage: Build the binary using golang base image
FROM golang:1.24
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server .
# Second Stage: Run the compiled binary inside alpine
FROM alpine
# Fix: Alpine needs ca-certificates to verify SSL certificates
RUN apk add --no-cache ca-certificates
# Copy from first stage
COPY --from=0 /app/server /app/server
WORKDIR /app
# Default startup command
CMD ["./server"]