# Build container
FROM golang:bookworm AS build
# Setup environment
RUN mkdir -p /data
WORKDIR /data
# Copy modules first to leverage Docker cache
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source
COPY . .
# Build the release
RUN make build/weron
# Extract the release
RUN mkdir -p /out
RUN cp out/weron /out/weron
# Release container
FROM debian:bookworm
# Install certificates
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
# Add the release
COPY --from=build /out/weron /usr/local/bin/weron
# Ensure executable
RUN chmod +x /usr/local/bin/weron
# Run the binary by default
CMD ["/usr/local/bin/weron"]