glehmann / tree-sitter-earthfile

Tree-sitter grammar for Earthfile
MIT License
9 stars 1 forks source link

spaces should be allowed between the backslash and the carriage return #18

Open rockerBOO opened 1 month ago

rockerBOO commented 1 month ago
VERSION 0.7
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
WORKDIR /code
RUN --mount=type=cache,target=/var/cache/apt \
        apt-get update \
         && DEBIAN_FRONTEND=noninteractive  TZ=America/New_York apt-get install --no-install-recommends -y fonts-dejavu-core rsync git jq moreutils aria2 python3 python3-venv python3-pip ffmpeg \
    libsm6 \ 
    libxext6 \
         && apt-get clean \
         && rm -rf /var/lib/apt/lists/* 
ARG DEBIAN_FRONTEND=noninteractive

deps:
    RUN --mount=type=cache,target=/cache --mount=type=cache,target=/root/.cache/pip \
        aria2c -x 5 --dir /cache --out torch-2.0.1-cp310-cp310-linux_x86_64.whl -c \
        https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp310-cp310-linux_x86_64.whl && \
        pip install /cache/torch-2.0.1-cp310-cp310-linux_x86_64.whl torchvision --index-url https://download.pytorch.org/whl/cu118
    RUN pip3 install wheel
    COPY requirements.txt ./
    RUN pip wheel -r requirements.txt --wheel-dir=wheels

build:
    FROM +deps
    COPY x.py x.py
    SAVE ARTIFACT x.py /x.py
    SAVE ARTIFACT wheels /wheels

docker:
    FROM +deps
    COPY +build/x.py x.py
    COPY +build/wheels wheels
    COPY requirements.txt ./
    RUN pip install --no-index --find-links=wheels -r requirements.txt
    ENTRYPOINT ["python3", "./x.py"]
        SAVE IMAGE rockerboo/x:latest
1 failure:

correct / expected / unexpected

  1. test_long_run:

    (source_file
      (block
        (version_command
          (version_major_minor))
        (from_command
          (image_spec
            (image_name)
            (image_tag)))
        (workdir_command
          (string
            (unquoted_string)))
        (run_command
          (options
            (mount
              (string
                (unquoted_string)
                (unquoted_string))))
          (line_continuation)
          (shell_fragment
            (line_continuation)
            (line_continuation))))
      (ERROR))
)

Thanks

glehmann commented 1 week ago

Hi @rockerBOO , thanks for the example. It is failing because of the trailing space after the backslash in this line:

    libsm6 \ 

I’m surprised that’s even allowed in the earthfile — I’ll give it a try :-)

glehmann commented 1 week ago

ok, It is indeed working. How the eol is managed in earthfile is still puzzling me

rockerBOO commented 2 days ago

thank you, I can work around this for now.