diff --git a/Dockerfile b/Dockerfile index 6cef4cd..e303fe3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,13 @@ WORKDIR /app ENV GOTOOLCHAIN=auto -COPY go.mod go.sum ./ +COPY src/go.mod src/go.sum ./ RUN go mod download -COPY . ./ +COPY src/ ./ -RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /ax . +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ + go build -ldflags="-s -w" -trimpath -o /ax . FROM alpine:latest @@ -17,10 +18,8 @@ RUN apk --no-cache add ca-certificates WORKDIR /data -COPY --from=builder /ax /app/ax - -ENV AX_DB_PATH=/data/.ax.db +COPY --from=builder /ax /usr/local/bin/ax EXPOSE 7000 -ENTRYPOINT ["/app/ax", "serve"] +ENTRYPOINT ["ax"] diff --git a/src/store/graph_store_sqlite.go b/src/store/graph_store_sqlite.go index f9b5abf..d3ffe1e 100644 --- a/src/store/graph_store_sqlite.go +++ b/src/store/graph_store_sqlite.go @@ -59,14 +59,9 @@ func InitSQLiteStore(path string) error { return nil } -// FindAndOpenSQLiteStore opens the SQLite database. If the AX_DB_PATH environment -// variable is set, it uses that path directly. Otherwise, it walks up from the +// FindAndOpenSQLiteStore opens the SQLite database by walking up from the // current working directory to find an .ax/ax.db file. func FindAndOpenSQLiteStore() (GraphStore, error) { - if dbpath := os.Getenv("AX_DB_PATH"); dbpath != "" { - return NewSQLiteStore(dbpath) - } - dataRoot, err := FindDataRoot(".local", "share") if err != nil { return nil, fmt.Errorf("failed to find data dir: %w", err)