Skip to content

Fix Dockerfile.test parse error in docker-test.yml workflow#686

Merged
A1L13N merged 3 commits into
mainfrom
copilot/fix-41022b33-4b23-4d3c-a5f2-52a3d79cab25
Oct 4, 2025
Merged

Fix Dockerfile.test parse error in docker-test.yml workflow#686
A1L13N merged 3 commits into
mainfrom
copilot/fix-41022b33-4b23-4d3c-a5f2-52a3d79cab25

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 4, 2025

Problem

The docker-test.yml GitHub Actions workflow was failing with a Dockerfile parse error:

ERROR: failed to build: failed to solve: dockerfile parse error on line 13: unknown instruction: poetry

Root Cause

The workflow creates a Dockerfile.test file using a heredoc. Within this Dockerfile, a comment was embedded in the middle of a multi-line RUN command with backslash continuation:

RUN python -m pip install --upgrade pip wheel setuptools && \
    pip install poetry==1.8.3 && \
    poetry config virtualenvs.create false --local || true && \
    # Install only dependencies (skip installing the project itself until after sources copied)
    poetry install --only main --no-root --no-interaction --no-ansi

When a comment appears within a backslash-continued command, it breaks the continuation chain. This causes Docker to interpret poetry install... as a separate Dockerfile instruction rather than part of the RUN command, resulting in the parse error "unknown instruction: poetry".

Solution

Moved the comment to its own line before the RUN command:

# Install only dependencies (skip installing the project itself until after sources copied)
RUN python -m pip install --upgrade pip wheel setuptools && \
    pip install poetry==1.8.3 && \
    poetry config virtualenvs.create false --local || true && \
    poetry install --only main --no-root --no-interaction --no-ansi

This ensures the RUN command with backslash continuation is uninterrupted, allowing Docker to parse it correctly as a single instruction.

Testing

Verified that the generated Dockerfile.test now parses successfully without the "unknown instruction: poetry" error. The RUN command is properly recognized as a single multi-line instruction.

Fixes #1

Original prompt

#1 [internal] load build definition from Dockerfile.test
#1 transferring dockerfile: 1.15kB done
#1 DONE 0.0s
Dockerfile.test:13

11 | COPY pyproject.toml poetry.lock* ./
12 | RUN python -m pip install --upgrade pip wheel setuptools && pip install poetry==1.8.3 && poetry config virtualenvs.create false --local || true && # Install only dependencies (skip installing the project itself until after sources copied)
13 | >>> poetry install --only main --no-root --no-interaction --no-ansi
14 |
15 | # Copy project files

ERROR: failed to build: failed to solve: dockerfile parse error on line 13: unknown instruction: poetry
Error: buildx failed with: ERROR: failed to build: failed to solve: dockerfile parse error on line 13: unknown instruction: poetry


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 4, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Copilot AI changed the title #1 [internal] load build definition from Dockerfile.test #1 transferring dockerfile: 1.15kB done #1 DONE 0.0s Dockerfile.test:13 -------------------- 11 | COPY pyproject.toml poetry.lock* ./ 12 | RUN python -m pip install --upgrade pip whee... Fix Dockerfile.test parse error in docker-test.yml workflow Oct 4, 2025
Copilot AI requested a review from A1L13N October 4, 2025 22:04
@A1L13N A1L13N marked this pull request as ready for review October 4, 2025 22:59
@A1L13N A1L13N merged commit 5070214 into main Oct 4, 2025
12 checks passed
@A1L13N A1L13N deleted the copilot/fix-41022b33-4b23-4d3c-a5f2-52a3d79cab25 branch October 4, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants