fix: exit non-zero when git:from-image deploys fail to start the app

Also ensure the repository doesn't get updated to an invalid state in those failure cases.

Closes #5538
This commit is contained in:
Jose Diaz-Gonzalez
2022-12-27 02:37:18 -05:00
parent 32af26d7a1
commit fd2c540cd5
4 changed files with 102 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
FROM python:3.11.0-buster
ARG BUILD_ARG=key
WORKDIR /app
COPY . /app
RUN echo $BUILD_ARG > BUILD_ARG.contents

View File

@@ -1,6 +1,7 @@
import http.server
import json
import os
import sys
class GetHandler(http.server.BaseHTTPRequestHandler):
@@ -17,6 +18,10 @@ class GetHandler(http.server.BaseHTTPRequestHandler):
if __name__ == "__main__":
if os.getenv("FAIL_ON_STARTUP") == "true":
print("Failing on startup due to FAIL_ON_STARTUP=true")
sys.exit(1)
port = int(os.getenv("PORT", 5000))
server = http.server.HTTPServer(("0.0.0.0", port), GetHandler)
print("Listening on port {0}".format(port))