8000 Util: support building in place for ECR docker images by simonrw · Pull Request #11806 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Util: support building in place for ECR docker images #11806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

simonrw
Copy link
Contributor
@simonrw simonrw commented Nov 7, 2024

Motivation

When building docker images for our tests, it is sometimes useful to be able to include external files into the image. The current way the generate_ecr_from_dockerfile utility function works is to copy the Dockerfile into a temporary location, however this does not allow the Docker context to access these other files.

For example, with the following file:

FROM python:3.12-alpine

COPY app.py /app.py
CMD ["python", "/app.py"]

and directory layout:

image-path/
  Dockerfile
  app.py

will not build because the Dockerfile is copied to a temporary location and built from there.

Changes

Add a new flag: build_in_place which defaults to False (to maintain current default behaviour) which does not copy the Dockerfile away from its original position.

Note: this may induce lots of copying of large contexts to the Docker daemon if e.g. the Dockerfile is contained in a larger project without proper .dockerignore setup, however this is fairly easy to recognise and fix.

@simonrw simonrw added the semver: patch Non-breaking changes which can be included in patch releases label Nov 7, 2024
@simonrw simonrw self-assigned this Nov 7, 2024
@simonrw simonrw requested a review from pinzon November 7, 2024 15:21
Copy link
github-actions bot commented Nov 7, 2024

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 55m 24s ⏱️ +57s
4 104 tests ±0  3 772 ✅ ±0  332 💤 ±0  0 ❌ ±0 
4 106 runs  ±0  3 772 ✅ ±0  334 💤 ±0  0 ❌ ±0 

Results for commit fb8e92c. ± Comparison against base commit 8859590.

♻️ This comment has been updated with latest results.

@simonrw simonrw force-pushed the util/docker-push-to-ecr-build-in-place branch from e263b20 to 3835384 Compare November 7, 2024 21:28
@simonrw simonrw marked this pull request as ready for review November 7, 2024 21:42
@simonrw simonrw added this to the Playground milestone Nov 13, 2024
@simonrw simonrw force-pushed the util/docker-push-to-ecr-build-in-place branch from 3835384 to 1072291 Compare January 7, 2025 17:07
@simonrw simonrw force-pushed the util/docker-push-to-ecr-build-in-place branch from 1072291 to 7346851 Compare January 23, 2025 14:12
@simonrw simonrw force-pushed the util/docker-push-to-ecr-build-in-place branch from 7346851 to fb8e92c Compare February 26, 2025 15:19
@simonrw simonrw merged commit 3cac154 into master Feb 27, 2025
31 checks passed
@simonrw simonrw deleted the util/docker-push-to-ecr-build-in-place branch February 27, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0