# syntax=docker/dockerfile:1 # Build stage FROM golang:1.22-alpine AS builder WORKDIR /app # Copy go mod files and download dependencies COPY go.mod go.sum ./ RUN go mod download # Copy the rest of the application COPY . . # Build the application RUN go build -o mqtt_presence_redis_go mqtt_presence_redis_go.go # Runtime stage FROM alpine:3.20 WORKDIR /app COPY --from=builder /app/mqtt_presence_redis_go . # Expose default MQTT port if needed EXPOSE 1883 # Command to run the binary CMD ["./mqtt_presence_redis_go"]