Skip to content

Commit

Permalink
Merge pull request #1704 from PrefectHQ/always-install-prefect
Browse files Browse the repository at this point in the history
Always attempt to install prefect in base image
  • Loading branch information
cicdw committed Nov 5, 2019
2 parents 39131bb + 04d5a73 commit a4c4b19
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ These changes are available in the [master branch](https://github.com/PrefectHQ/
### Fixes

- Fix Fargate Agent access defaults and environment variable support - [#1687](https://github.com/PrefectHQ/prefect/pull/1687)
- Attempt to install prefect in any docker image (if it is not already installed) - [#1704](https://github.com/PrefectHQ/prefect/pull/1704)

### Deprecations

Expand Down
17 changes: 10 additions & 7 deletions src/prefect/environments/storage/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,20 @@ def __init__(
else:
# create an image from python:*-slim directly
self.base_image = "python:{}-slim".format(python_version)
self.extra_commands.extend(
[
"apt update && apt install -y gcc git && rm -rf /var/lib/apt/lists/*",
"pip install git+https://github.com/PrefectHQ/prefect.git@{}#egg=prefect[kubernetes]".format(
self.prefect_version
),
]
self.extra_commands.append(
"apt update && apt install -y gcc git && rm -rf /var/lib/apt/lists/*",
)
else:
self.base_image = base_image

# we should always try to install prefect, unless it is already installed. We can't determine this until
# image build time.
self.extra_commands.append(
"pip show prefect || pip install git+https://github.com/PrefectHQ/prefect.git@{}#egg=prefect[kubernetes]".format(
self.prefect_version
),
)

not_absolute = [
file_path for file_path in self.files if not os.path.isabs(file_path)
]
Expand Down
4 changes: 2 additions & 2 deletions tests/environments/storage/test_docker_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ def test_create_dockerfile_from_base_image():
"master",
(
"FROM python:3.6-slim",
"pip install git+https://github.com/PrefectHQ/prefect.git@master",
"pip show prefect || pip install git+https://github.com/PrefectHQ/prefect.git@master",
),
),
(
"424be6b5ed8d3be85064de4b95b5c3d7cb665510",
(
"FROM python:3.6-slim",
"apt update && apt install -y gcc git && rm -rf /var/lib/apt/lists/*",
"pip install git+https://github.com/PrefectHQ/prefect.git@424be6b5ed8d3be85064de4b95b5c3d7cb665510#egg=prefect[kubernetes]",
"pip show prefect || pip install git+https://github.com/PrefectHQ/prefect.git@424be6b5ed8d3be85064de4b95b5c3d7cb665510#egg=prefect[kubernetes]",
),
),
],
Expand Down

0 comments on commit a4c4b19

Please sign in to comment.