Skip to content
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

ignore patterns defined in dockerignore #1725

Merged

Conversation

Luukvdm
Copy link
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

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
container.go Outdated Show resolved Hide resolved
@mdelapenya mdelapenya added the hacktoberfest Pull Requests accepted for Hacktoberfest. label Oct 9, 2023
container.go Outdated Show resolved Hide resolved
@mdelapenya
Copy link
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
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
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
114 checks passed
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)
  ...
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
2 participants