Skip to content

ignore patterns defined in dockerignore#1725

Merged
mdelapenya merged 6 commits intotestcontainers:mainfrom
Luukvdm:feature/support-dockerignore-files
Oct 16, 2023
Merged

ignore patterns defined in dockerignore#1725
mdelapenya merged 6 commits intotestcontainers:mainfrom
Luukvdm:feature/support-dockerignore-files

Conversation

@Luukvdm
Copy link
Copy Markdown
Contributor

@Luukvdm Luukvdm commented Oct 8, 2023

What does this PR do?

Respect .dockerignore files similar to how the Docker CLI handles them.

Why is it important?

Prevents unnecessary large docker images and mirrors behavior of the Docker CLI.

Related issues

@Luukvdm Luukvdm requested a review from a team as a code owner October 8, 2023 14:08
@netlify
Copy link
Copy Markdown

netlify bot commented Oct 8, 2023

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 58bc6fe
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/652ce854d15edd00083d3dbb
😎 Deploy Preview https://deploy-preview-1725--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mdelapenya mdelapenya self-assigned this Oct 9, 2023
@mdelapenya mdelapenya added the feature New functionality or new behaviors on the existing one label Oct 9, 2023
@mdelapenya mdelapenya added the hacktoberfest Pull Requests accepted for Hacktoberfest. label Oct 9, 2023
@mdelapenya
Copy link
Copy Markdown
Member

@Luukvdm there is a few tests failing. Please see https://github.com/testcontainers/testcontainers-go/actions/runs/6448106348/job/17580097884?pr=1725

They are all related to the .dockerignore new feature we added in this PR, very likely because the file does not exist for the tests. I think we are missing a check for the file existence 🤔

Thankfully we have tests! 💪

@Luukvdm
Copy link
Copy Markdown
Contributor Author

Luukvdm commented Oct 14, 2023

@Luukvdm there is a few tests failing. Please see https://github.com/testcontainers/testcontainers-go/actions/runs/6448106348/job/17580097884?pr=1725

They are all related to the .dockerignore new feature we added in this PR, very likely because the file does not exist for the tests. I think we are missing a check for the file existence 🤔

Thankfully we have tests! 💪

Thank god for automated testing 😄
I made a silly mistake in the error handling. I fixed it and added a regression test just in case. Do you agree with the changes?
Also wasn't sure about code styling/ order and added the function under the GetContext function.

Copy link
Copy Markdown
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for your contribution!

@mdelapenya mdelapenya merged commit ee1cf1a into testcontainers:main Oct 16, 2023
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Oct 18, 2023
* main:
  fix: data race in docker client `Info()` (testcontainers#1779)
  Use correct formatting directive for errors in lifecycle logs (testcontainers#1780)
  chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (testcontainers#1778)
  chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (testcontainers#1728)
  chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (testcontainers#1732)
  ignore patterns defined in dockerignore (testcontainers#1725)
mdelapenya added a commit that referenced this pull request Oct 26, 2023
* main: (27 commits)
  docs: remove OpenSSF scorecard (#1823)
  Auto-cleanup of k6 build cache (#1788)
  Add OpenSSF Scorecards GitHub Action (#1795)
  chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#1822)
  chore: expose SessionID (#1793)
  chore: use HTTP calls to invoke the lambda from the tests (#1794)
  wait for log producer to really stop inside StopLogProducer func (#1701)
  chore(deps): bump github.com/nats-io/nats-server/v2 in /modules/nats (#1784)
  chore(deps): bump urllib3 from 2.0.6 to 2.0.7 (#1781)
  chore: add an example of using localstack alongside AWS lambdas (#1790)
  chore(deps): combine and bump compose dependencies (#1787)
  feat: support for replacing images with custom substitutions (#1719)
  fix: data race in docker client `Info()` (#1779)
  Use correct formatting directive for errors in lifecycle logs (#1780)
  chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (#1778)
  chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (#1728)
  chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1732)
  ignore patterns defined in dockerignore (#1725)
  Fix wrong module names (#1776)
  docs: add default options to k6 module (#1744)
  ...
mdelapenya added a commit that referenced this pull request Oct 26, 2023
…ers/image-spec-1.1.0-rc5

* main: (49 commits)
  docs: remove OpenSSF scorecard (#1823)
  Auto-cleanup of k6 build cache (#1788)
  Add OpenSSF Scorecards GitHub Action (#1795)
  chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#1822)
  chore: expose SessionID (#1793)
  chore: use HTTP calls to invoke the lambda from the tests (#1794)
  wait for log producer to really stop inside StopLogProducer func (#1701)
  chore(deps): bump github.com/nats-io/nats-server/v2 in /modules/nats (#1784)
  chore(deps): bump urllib3 from 2.0.6 to 2.0.7 (#1781)
  chore: add an example of using localstack alongside AWS lambdas (#1790)
  chore(deps): combine and bump compose dependencies (#1787)
  feat: support for replacing images with custom substitutions (#1719)
  fix: data race in docker client `Info()` (#1779)
  Use correct formatting directive for errors in lifecycle logs (#1780)
  chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (#1778)
  chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (#1728)
  chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1732)
  ignore patterns defined in dockerignore (#1725)
  Fix wrong module names (#1776)
  docs: add default options to k6 module (#1744)
  ...
ttruongatl pushed a commit to ttruongatl/testcontainers-go that referenced this pull request Feb 15, 2025
* ignore patterns defined in dockerignore

* fixed mistake in handling the error when dockerignore file doesn't exist

* added a regression test for dockerignore parsing

* chore: mod tidy modules

* fix: set 1.20 go version in compose

---------

Co-authored-by: Manuel de la Peña <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New functionality or new behaviors on the existing one hacktoberfest Pull Requests accepted for Hacktoberfest.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Respect .dockerignore in FromDockerfile builds

3 participants