|  | 
|  | 1 | +FROM golang:1.21.3 AS builder | 
|  | 2 | + | 
|  | 3 | +ARG VERSION=8.22.0 | 
|  | 4 | +ENV VERSION="${VERSION}" | 
|  | 5 | + | 
|  | 6 | +# Default value | 
|  | 7 | +# Run `--build-arg BILLING=true` to enable billing | 
|  | 8 | +ARG BILLING=false | 
|  | 9 | +ENV BILLING="${BILLING}" | 
|  | 10 | + | 
|  | 11 | +# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch | 
|  | 12 | +ARG HOSTED_BILLING=false | 
|  | 13 | +ENV HOSTED_BILLING="${HOSTED_BILLING}" | 
|  | 14 | + | 
|  | 15 | +# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters | 
|  | 16 | +ARG CLUSTER_BILLING=true | 
|  | 17 | +ENV CLUSTER_BILLING="${CLUSTER_BILLING}" | 
|  | 18 | + | 
|  | 19 | +# Run `--build-arg OPENSOURCE=true` to build opensource  | 
|  | 20 | +ARG OPENSOURCE=false | 
|  | 21 | +ENV OPENSOURCE="${OPENSOURCE}" | 
|  | 22 | + | 
|  | 23 | +# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing | 
|  | 24 | +ARG IGNORE_BILLING_MIDDLEWARE=false | 
|  | 25 | +ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}" | 
|  | 26 | + | 
|  | 27 | +# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit | 
|  | 28 | +ARG PLAN_REFRESH_INTERVAL=1 | 
|  | 29 | +ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}" | 
|  | 30 | + | 
|  | 31 | +# Install tools required for project | 
|  | 32 | +# Run `docker build --no-cache .` to update dependencies | 
|  | 33 | +RUN apt-get update | 
|  | 34 | +RUN apt-get -y install build-essential git | 
|  | 35 | +WORKDIR /reactivesearch | 
|  | 36 | + | 
|  | 37 | +# List project dependencies with go.mod and go.sum | 
|  | 38 | +COPY go.mod go.sum ./ | 
|  | 39 | + | 
|  | 40 | +# Install library dependencies | 
|  | 41 | +RUN go mod download | 
|  | 42 | + | 
|  | 43 | +# Copy the entire project and build it | 
|  | 44 | +# This layer is rebuilt when a file changes in the project directory | 
|  | 45 | +COPY . . | 
|  | 46 | +RUN make | 
|  | 47 | + | 
|  | 48 | +# Final stage: Create the running container | 
|  | 49 | +FROM debian:bookworm AS final | 
|  | 50 | + | 
|  | 51 | +# Create env folder | 
|  | 52 | +RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env | 
|  | 53 | + | 
|  | 54 | +# Import the compiled executable from the first stage. | 
|  | 55 | +COPY --from=builder /reactivesearch /reactivesearch | 
|  | 56 | +WORKDIR /reactivesearch | 
|  | 57 | + | 
|  | 58 | +EXPOSE 8000 | 
|  | 59 | +ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"] | 
0 commit comments