mirror of
https://github.com/luxfi/indexer.git
synced 2026-09-24 00:25:37 +00:00
23 lines
722 B
Docker
23 lines
722 B
Docker
FROM golang:1.26-alpine AS builder
|
|
RUN apk add --no-cache gcc musl-dev sqlite-dev
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
ARG VERSION=dev
|
|
# -D_LARGEFILE64_SOURCE fixes pread64/pwrite64 on musl
|
|
RUN CGO_ENABLED=1 CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOOS=linux go build \
|
|
-ldflags="-s -w -X main.version=${VERSION}" \
|
|
-o /explorer ./cmd/explorer/
|
|
|
|
FROM alpine:3.21
|
|
RUN apk add --no-cache ca-certificates sqlite-libs
|
|
COPY --from=builder /explorer /usr/local/bin/explorer
|
|
RUN adduser -D -u 65532 explorer
|
|
USER explorer
|
|
VOLUME /data
|
|
ENV DATA_DIR=/data HTTP_ADDR=:8090
|
|
EXPOSE 8090
|
|
HEALTHCHECK --interval=30s --timeout=5s CMD wget -qO- http://localhost:8090/health || exit 1
|
|
ENTRYPOINT ["explorer"]
|