aws-amplify / aws-amplify/amplify-hosting

Ability to run docker command in build pipeline

Open
#3,992 1 comment 2 reactions 0 assignees View on GitHub
feature-request
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [x] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [x] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [x] I have removed any sensitive information from my code snippets and submission.

### Amplify Hosting feature

Build settings

### Is your feature request related to a problem? Please describe:

We need the ability to build docker images in the build step of the amplify pipeline. I'm currently trying to build a python 3.13 function, but the version in the build image is 3.10. An easy workaround would be to allow for something like:

```typescript
new Function(scope, id, {
handler,
functionName: name,
runtime: Runtime.PYTHON_3_13,
timeout: Duration.minutes(15),
code: Code.fromAsset(functionDir, {
bundling: {
image: DockerImage.fromRegistry(
"public.ecr.aws/docker/library/python:3.13"
),
user: "0:0",
entrypoint: ["/bin/bash"],
command: [
"-c",
[
"python3 -m pip install /asset-input -t /asset-output",
"..."
].join(" && "),
],
},
}),
```

But this fails in the amplify pipeline with:

```
2025-02-12T22:33:20.577Z [INFO]: CustomFunctionProviderDockerError: Failed to instantiate custom function provider

Resolution: See https://docs.amplify.aws/react/build-a-backend/functions/custom-functions for more details about current limitations and troubleshooting steps.

Cause: Failed to bundle asset amplify-d36fq56lkpqjkv-dev-branch-cce3d3c6f0/function/payerTocReportinPlans/Code/Stage, bundle output is located at /codebuild/output/src4059803044/src/campaign-healthcare-web/.amplify/artifacts/cdk.out/asset.93520a826d8fa364dac7c7e5dab567f2455cba43ffe272a9ff765306c840c9de-error: Error: spawnSync docker ENOENT
```

The docs mention this error, but don't address it in this context (build time). At this point my only options appear to be 1) live at the mercy of the built-in python version which can change without warning and will be perpetually out of date 2) build a custom Amplify image where I need to take on the management of Amplify build-time dependencies which is not my scope.

### Describe how you'd like this feature to work

Allow for `docker-in-docker` during amplify build or expand the available custom library overrides to include python (and maintain a current list of LTS python versions).

Contributor guide

Open the contributing guide

Research direction

Start with the Build settings context and the custom-functions documentation linked in the issue, then trace how the Amplify build pipeline handles CDK asset bundling and Docker-based bundling. Compare the requested docker-in-docker and Python-version override options against the documented limitations; done means a supported, tested path is defined and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, python
Domain
build-system, ci-cd, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.