2018-03-19 22:40:50 +00:00
|
|
|
"""Generates Dockerfiles from the legacy Binder Dockerfiles
|
|
|
|
based on `andrewosh/binder-base`.
|
|
|
|
|
|
|
|
The Dockerfile is amended to add the contents of the repository
|
|
|
|
to the image and install a supported version of the notebook
|
|
|
|
and IPython kernel.
|
|
|
|
|
2019-12-11 06:12:54 +00:00
|
|
|
Note: This buildpack has been deprecated.
|
2017-11-30 07:20:24 +00:00
|
|
|
"""
|
2019-12-11 06:12:54 +00:00
|
|
|
import logging
|
2017-11-30 07:20:24 +00:00
|
|
|
|
2019-03-29 08:40:10 +00:00
|
|
|
|
2019-12-11 06:12:54 +00:00
|
|
|
class LegacyBinderDockerBuildPack:
|
|
|
|
"""Legacy build pack for compatibility to first version of Binder.
|
2017-11-30 07:20:24 +00:00
|
|
|
|
2019-12-11 06:12:54 +00:00
|
|
|
This buildpack has been deprecated.
|
2019-05-31 09:10:17 +00:00
|
|
|
"""
|
2017-11-30 07:20:24 +00:00
|
|
|
|
2022-06-25 01:13:53 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
pass
|
|
|
|
|
2017-11-30 07:20:24 +00:00
|
|
|
def detect(self):
|
2019-12-11 06:12:54 +00:00
|
|
|
"""Check if current repo should be built with the Legacy BuildPack."""
|
|
|
|
log = logging.getLogger("repo2docker")
|
2017-11-30 07:20:24 +00:00
|
|
|
try:
|
2022-10-23 16:09:11 +00:00
|
|
|
with open("Dockerfile") as f:
|
2017-11-30 07:20:24 +00:00
|
|
|
for line in f:
|
2019-05-31 09:10:17 +00:00
|
|
|
if line.startswith("FROM"):
|
|
|
|
if "andrewosh/binder-base" in line.split("#")[0].lower():
|
2019-12-11 06:12:54 +00:00
|
|
|
log.error(
|
2020-01-25 13:29:17 +00:00
|
|
|
"The legacy buildpack was removed in January 2020."
|
2019-12-11 06:12:54 +00:00
|
|
|
)
|
|
|
|
log.error(
|
|
|
|
"Please see https://repo2docker.readthedocs.io/en/"
|
|
|
|
"latest/configuration/index.html for alternative ways "
|
|
|
|
"of configuring your repository."
|
|
|
|
)
|
|
|
|
raise RuntimeError("The legacy buildpack has been removed.")
|
2017-11-30 07:20:24 +00:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
except FileNotFoundError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
return False
|