summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/18295.docker1
-rw-r--r--docker/Dockerfile-workers2
-rw-r--r--docker/complement/Dockerfile2
-rwxr-xr-xdocker/configure_workers_and_start.py5
4 files changed, 7 insertions, 3 deletions
diff --git a/changelog.d/18295.docker b/changelog.d/18295.docker
new file mode 100644

index 0000000000..239def1f54 --- /dev/null +++ b/changelog.d/18295.docker
@@ -0,0 +1 @@ +When generating container scripts from templates, don't add a leading newline so that their shebangs may be handled correctly. diff --git a/docker/Dockerfile-workers b/docker/Dockerfile-workers
index a7f576184d..6d0fc1440b 100644 --- a/docker/Dockerfile-workers +++ b/docker/Dockerfile-workers
@@ -74,4 +74,4 @@ FROM $FROM # Replace the healthcheck with one which checks *all* the workers. The script # is generated by configure_workers_and_start.py. HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \ - CMD /bin/sh /healthcheck.sh + CMD ["/healthcheck.sh"] diff --git a/docker/complement/Dockerfile b/docker/complement/Dockerfile
index dd029c5fbc..6ed084fe5d 100644 --- a/docker/complement/Dockerfile +++ b/docker/complement/Dockerfile
@@ -58,4 +58,4 @@ ENTRYPOINT ["/start_for_complement.sh"] # Update the healthcheck to have a shorter check interval HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \ - CMD /bin/sh /healthcheck.sh + CMD ["/healthcheck.sh"] diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py
index ff5cff3221..8f96e57e50 100755 --- a/docker/configure_workers_and_start.py +++ b/docker/configure_workers_and_start.py
@@ -376,9 +376,11 @@ def convert(src: str, dst: str, **template_vars: object) -> None: # # We use append mode in case the files have already been written to by something else # (for instance, as part of the instructions in a dockerfile). + exists = os.path.isfile(dst) with open(dst, "a") as outfile: # In case the existing file doesn't end with a newline - outfile.write("\n") + if exists: + outfile.write("\n") outfile.write(rendered) @@ -998,6 +1000,7 @@ def generate_worker_files( "/healthcheck.sh", healthcheck_urls=healthcheck_urls, ) + os.chmod("/healthcheck.sh", 0o755) # Ensure the logging directory exists log_dir = data_dir + "/logs"