Skip to content

Commit

Permalink
Add examples of poetry with src dir
Browse files Browse the repository at this point in the history
  • Loading branch information
n8felton committed Jan 4, 2024
1 parent bf4765f commit a75d4af
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/build-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Note that this example may create resources which cost money. Run `terraform des
| <a name="module_package_dir_without_pip_install"></a> [package\_dir\_without\_pip\_install](#module\_package\_dir\_without\_pip\_install) | ../../ | n/a |
| <a name="module_package_file"></a> [package\_file](#module\_package\_file) | ../../ | n/a |
| <a name="module_package_file_with_pip_requirements"></a> [package\_file\_with\_pip\_requirements](#module\_package\_file\_with\_pip\_requirements) | ../../ | n/a |
| <a name="module_package_src_poetry"></a> [package\_src\_poetry](#module\_package\_src\_poetry) | ../../ | n/a |
| <a name="module_package_src_poetry2"></a> [package\_src\_poetry2](#module\_package\_src\_poetry2) | ../../ | n/a |
| <a name="module_package_with_commands_and_patterns"></a> [package\_with\_commands\_and\_patterns](#module\_package\_with\_commands\_and\_patterns) | ../../ | n/a |
| <a name="module_package_with_docker"></a> [package\_with\_docker](#module\_package\_with\_docker) | ../../ | n/a |
| <a name="module_package_with_npm_requirements_in_docker"></a> [package\_with\_npm\_requirements\_in\_docker](#module\_package\_with\_npm\_requirements\_in\_docker) | ../../ | n/a |
Expand Down
39 changes: 39 additions & 0 deletions examples/build-package/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,45 @@ module "package_dir_poetry" {
artifacts_dir = "${path.root}/builds/package_dir_poetry/"
}

# Create zip-archive of a src directory where "poetry export" & "pip install --no-deps" will also be executed (using docker)
module "package_src_poetry" {
source = "../../"

create_function = false

build_in_docker = true
runtime = "python3.9"
docker_image = "build-python3.9-poetry"
docker_file = "${path.module}/../fixtures/python3.9-app-src-poetry/docker/Dockerfile"

source_path = [
"${path.module}/../fixtures/python3.9-app-src-poetry/src",
{
path = "${path.module}/../fixtures/python3.9-app-src-poetry/pyproject.toml"
poetry_install = true
}
]
artifacts_dir = "${path.root}/builds/package_dir_poetry/"
}

# Create zip-archive of a src directory where "poetry export" & "pip install --no-deps" will also be executed (using docker)
module "package_src_poetry2" {
source = "../../"

create_function = false

build_in_docker = true
runtime = "python3.9"
docker_image = "build-python3.9-poetry"
docker_file = "${path.module}/../fixtures/python3.9-app-src-poetry/docker/Dockerfile"

source_path = [
"${path.module}/../fixtures/python3.9-app-src-poetry/src",
"${path.module}/../fixtures/python3.9-app-src-poetry/pyproject.toml"
]
artifacts_dir = "${path.root}/builds/package_dir_poetry/"
}

# Create zip-archive of a single directory where "poetry export" & "pip install --no-deps" will also be executed (not using docker)
module "package_dir_poetry_no_docker" {
source = "../../"
Expand Down

0 comments on commit a75d4af

Please sign in to comment.