Skip to content

Commit

Permalink
Merge pull request #845 from bjwswang/main
Browse files Browse the repository at this point in the history
chore: use alpine as base image and install packages to support pdf-t…
  • Loading branch information
bjwswang authored Mar 14, 2024
2 parents 92c9aeb + 4c04c87 commit 5f68126
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ COPY apiserver/ apiserver/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o apiserver-bin apiserver/main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot

# Use alpine as minimal base image to package the manager binary
FROM alpine:3.19.1

RUN apk update \
# Install packages to support pdf to text conversion
&& apk add --no-cache poppler-utils wv unrtf tidyhtml

WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/apiserver-bin ./apiserver
USER 65532:65532

RUN adduser -D -u 1000 1000

USER 1000

ENTRYPOINT ["/manager"]
12 changes: 2 additions & 10 deletions controllers/base/knowledgebase_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,6 @@ func (r *KnowledgeBaseReconciler) reconcileFileGroup(ctx context.Context, log lo

func (r *KnowledgeBaseReconciler) handleFile(ctx context.Context, log logr.Logger, file io.ReadCloser, fileName string, tags map[string]string, kb *arcadiav1alpha1.KnowledgeBase, store *arcadiav1alpha1.VectorStore, embedder *arcadiav1alpha1.Embedder) (err error) {
log = log.WithValues("fileName", fileName, "tags", tags)
if tags == nil {
log.Info("file tags is nil, ignore")
return fmt.Errorf("file tags is nil, %w", errFileSkipped)
}
v, ok := tags[arcadiav1alpha1.ObjectTypeTag]
if !ok {
log.Info("file tags object type not found, ignore")
return fmt.Errorf("file tags object type not found, %w", errFileSkipped)
}
if !embedder.Status.IsReady() {
return errEmbedderNotReady
}
Expand All @@ -530,7 +521,8 @@ func (r *KnowledgeBaseReconciler) handleFile(ctx context.Context, log logr.Logge
case ".txt":
loader = documentloaders.NewText(dataReader)
case ".csv":
if v == arcadiav1alpha1.ObjectTypeQA {
v, ok := tags[arcadiav1alpha1.ObjectTypeTag]
if ok && v == arcadiav1alpha1.ObjectTypeQA {
// for qa csv,we skip the text splitter
loader = pkgdocumentloaders.NewQACSV(dataReader, fileName)
} else {
Expand Down

0 comments on commit 5f68126

Please sign in to comment.