Skip to content

[Rust CLI] ubuild panics with “failed to create default configuration” on Docker (v0.6.10) #305

@saga-dash

Description

@saga-dash

When the resource path differed between the build stage and the runner stage in a Docker multi-stage build, ubuild resulted in an error.

Environment

  • Implementation: sudachi.rs (Rust)
  • CLI: sudachi-cli v0.6.10 (from GitHub releases tarball)
  • Docker
    • build image: rust:1.89-bullseye
    • runtime image: debian:stable-slim

Minimal repro (fails)

# dockerfile
FROM rust:1.89-bullseye AS build
ENV SUDACHI_RS_VERSION=v0.6.10
WORKDIR /opt
# WORKDIR /app
RUN apt-get update && apt-get install -y curl unzip ca-certificates && rm -rf /var/lib/apt/lists/*
RUN curl -sSL "https://github.com/WorksApplications/sudachi.rs/archive/refs/tags/${SUDACHI_RS_VERSION}.tar.gz" \
    | tar xz --strip-components=1 \
 && chmod +x ./fetch_dictionary.sh && ./fetch_dictionary.sh \
 && cargo build --release && cargo install --path sudachi-cli/

FROM debian:stable-slim
COPY --from=build /usr/local/cargo/bin/sudachi /usr/local/bin/sudachi
COPY --from=build /opt/resources /app/resources
#COPY --from=build /app/resources /app/resources
WORKDIR /work
ENTRYPOINT ["sudachi"]
# dict/user.csv
高輪ゲートウェイ駅,4786,5146,8000,高輪ゲートウェイ駅,名詞,固有名詞,一般,*,*,*,タカナワゲートウェイエキ,高輪ゲートウェイ駅,*,*,*,*,*

Run

docker build -t sudachi .
docker run --rm -v "$PWD/dict:/work" sudachi ubuild -s /app/resources/system.dic -o /work/user.dic /work/user.csv
thread 'main' panicked at sudachi-cli/src/build.rs:146:47:
failed to create default configuration: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
日本語の補足 Dockerのマルチステージビルドでresourcesのパスをbuildとrunnerと別のものにしたところ、ubuildでエラーとなりました。 buildとrunnerのパスを合わせるとエラーは出ません

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions