whatsapp-multi-devicewhatsapp-apiwhatsapprestgolanggowhatsapp-web-multi-devicewhatsapp-api-gorest-apigolang-whatsapp-apigolang-whatsappbot
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
866 B
29 lines
866 B
############################
|
|
# STEP 1 build executable binary
|
|
############################
|
|
FROM golang:1.21.5-alpine3.19 AS builder
|
|
RUN apk update && apk add --no-cache gcc musl-dev gcompat
|
|
WORKDIR /whatsapp
|
|
COPY ./src .
|
|
|
|
# Fetch dependencies.
|
|
RUN go mod download
|
|
# Build the binary.
|
|
RUN go build -o /app/whatsapp
|
|
|
|
#############################
|
|
## STEP 2 build a smaller image
|
|
#############################
|
|
FROM alpine:3.19
|
|
RUN apk update && apk add --no-cache ffmpeg
|
|
WORKDIR /app
|
|
# Copy compiled from builder.
|
|
COPY --from=builder /app/whatsapp /app/whatsapp
|
|
|
|
# Set default environment variables for port and webhook
|
|
ENV PORT 3000
|
|
ENV WEBHOOK "http://localhost:3000/handler"
|
|
|
|
# Use shell form to ensure environment variables are evaluated
|
|
CMD ["sh", "-c", "/app/whatsapp -p ${PORT} -w=${WEBHOOK}"]
|
|
CMD ["/bin/sh", "-c", "/app/whatsapp --port ${PORT} -w=${WEBHOOK}"]
|