FROM golang:alpine AS builder WORKDIR /app RUN apk add --no-cache gcc musl-dev COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=1 go build -o fbot . FROM alpine:latest WORKDIR /app RUN apk add --no-cache ca-certificates supercronic RUN addgroup -g 1000 -S fbot && adduser -u 1000 -S fbot -G fbot COPY --from=builder /app/fbot /app/fbot COPY --from=builder /app/client-metadata.json /app/client-metadata.json RUN echo "0 */2 * * * /app/fbot run" > /app/crontab RUN chown -R fbot:fbot /app USER fbot ENTRYPOINT ["/usr/bin/supercronic"] CMD ["/app/crontab"]