Files
lambdaiot-core/Dockerfile

20 lines
523 B
Docker

# Build stage
FROM golang:1.21-alpine AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-s -w" -o /app/server ./cmd/server
# Final image
FROM alpine:3.18
RUN apk add --no-cache ca-certificates netcat-openbsd
COPY --from=builder /app/server /usr/local/bin/server
COPY scripts/wait-for-mqtt.sh /usr/local/bin/wait-for-mqtt.sh
RUN chmod +x /usr/local/bin/wait-for-mqtt.sh
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/wait-for-mqtt.sh"]