localstack.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. from materialize.mzcompose.service import (
  10. Service,
  11. )
  12. class Localstack(Service):
  13. def __init__(
  14. self,
  15. name: str = "localstack",
  16. image: str = "localstack/localstack:3.0.2",
  17. port: int = 4566,
  18. environment: list[str] = ["LOCALSTACK_HOST=localstack"],
  19. volumes: list[str] = ["/var/run/docker.sock:/var/run/docker.sock"],
  20. ) -> None:
  21. super().__init__(
  22. name=name,
  23. config={
  24. "image": image,
  25. "init": True,
  26. "ports": [port],
  27. "environment": environment,
  28. "volumes": volumes,
  29. "healthcheck": {
  30. "test": ["CMD", "curl", "-f", "localhost:4566/health"],
  31. "interval": "1s",
  32. "start_period": "120s",
  33. },
  34. },
  35. )