Skip to content

Conversation

@saehejkang
Copy link
Contributor

@saehejkang saehejkang commented Oct 31, 2025

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Closes #727

Tested variations of commands with stdin below

echo -e "FROM alpine\nRUN echo 'Hello World'" | container build -t myimage -f - .
container build -t myimage -f - . <<'EOF'
FROM alpine
RUN echo 'Hello World'
EOF
echo -e "FROM alpine\nRUN echo 'Hello World'" > Dockerfile.tmp
container build -t myimage -f Dockerfile.tmp .
rm Dockerfile.tmp

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@saehejkang saehejkang force-pushed the container-build-support-inline-stdin branch from 96aad2b to 9a0d411 Compare October 31, 2025 05:43
}

let buildFileData = try Data(contentsOf: URL(filePath: buildFilePath))
let buildFileData: Data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Could you add a test for this? Just copy one of the simple tests in CLIBuilderTest and supply the Dockerfile via stdin instead of a file.

I think this will require creating a separate helper function to https://github.com/apple/container/blob/main/Tests/CLITests/Subcommands/Build/CLIBuildBase.swift#L112, since there's nothing in that test support stuff that knows how to pipe stdin into container build.

Copy link
Contributor Author

@saehejkang saehejkang Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make changes in the run function of the CLITest file as well. There needs to be a way to add the data to the stdin pipe.

@saehejkang saehejkang force-pushed the container-build-support-inline-stdin branch from 71ea529 to 7b1c1fb Compare November 2, 2025 05:47
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.

[Request]: Support inline Dockerfile from stdin for container build

2 participants