mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Don't publish port / bind mount inside CircleCI
The remote docker endpoint we have does not support doing bind mounts from the CircleCI Host. We also can not access the published external network port, so let's sotp doing that.
This commit is contained in:
@@ -14,17 +14,12 @@ def build_systemd_image(image_name, source_path):
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def run_systemd_image(image_name, container_name, external_port, source_path):
|
def run_systemd_image(image_name, container_name):
|
||||||
"""
|
"""
|
||||||
Run docker image with systemd
|
Run docker image with systemd
|
||||||
|
|
||||||
Image named image_name should be built with build_systemd_image.
|
Image named image_name should be built with build_systemd_image.
|
||||||
|
|
||||||
source_path is mounted to /srv/src in the container, so all changes to the
|
|
||||||
source are reflected in the host.
|
|
||||||
|
|
||||||
Port 80 inside the container is made available to the host at external_port.
|
|
||||||
|
|
||||||
Container named container_name will be started.
|
Container named container_name will be started.
|
||||||
"""
|
"""
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
@@ -32,8 +27,6 @@ def run_systemd_image(image_name, container_name, external_port, source_path):
|
|||||||
'--privileged',
|
'--privileged',
|
||||||
'--detach',
|
'--detach',
|
||||||
'--name', container_name,
|
'--name', container_name,
|
||||||
'--publish', f'{external_port}:80',
|
|
||||||
'--mount', f'type=bind,source={source_path},target=/srv/src',
|
|
||||||
image_name
|
image_name
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -99,7 +92,7 @@ def main():
|
|||||||
if args.action == 'build-image':
|
if args.action == 'build-image':
|
||||||
build_systemd_image(image_name, source_path)
|
build_systemd_image(image_name, source_path)
|
||||||
elif args.action == 'start-container':
|
elif args.action == 'start-container':
|
||||||
run_systemd_image(image_name, container_name, 12000, source_path)
|
run_systemd_image(image_name, container_name)
|
||||||
elif args.action == 'stop-container':
|
elif args.action == 'stop-container':
|
||||||
remove_systemd_container(container_name)
|
remove_systemd_container(container_name)
|
||||||
elif args.action == 'run':
|
elif args.action == 'run':
|
||||||
|
|||||||
Reference in New Issue
Block a user