Kubernetes-pod-fails-with-crashloopbackoff while deploying using docker image on GCP

Hi, I created a docker file for my application:

FROM julia:1.6
RUN apt-get update && apt-get install -y gcc 
ENV JULIA_PROJECT @. 
WORKDIR /home 
ENV VERSION 1 
ADD . /home 
RUN julia deploy/packagecompile.jl 
EXPOSE 8080 
ENTRYPOINT ["julia", "-JApp.so", "-t", "auto", "-L", "src/App.jl"]

In this application the App.jl is starting server using the following command:

Genie.startup(8080, "localhost", async=true)

Using above parameters, I managed to successfully create the docker image. However when I deploy the image on GCP Kubernetes, I get an error

kubernetes-pod-fails-with-crashloopbackoff 

I researched on this issue and found out that the kubernete container closes after executing the docker image.
Ref: docker - Kubernetes Pod fails with CrashLoopBackOff - Stack Overflow

May I ask, Is there a way where I can keep this server running just using my docker image?
Thanks! Look forward to the suggestions.

I haven’t used Genie before, but I’m guessing async=true means that startup command doesn’t block and instead returns execution to you. If there’s no more commands in the script, then the script will exit. You can try this without docker by running julia -L src/App.jl yourself.

So perhaps the fix is to pass async=false instead.

Thanks @ericphanson for the response, highly appreciate it!
Indeed async=false keeps the server running, but I am using the client.jl as a test file and also to build the precompilation of the project.
And async=false doesn’t allow for the following code and files to be executed.

Ah, I see. I think in that case you want to wait on the async tasks at the end of the script, so the script doesn’t finish until they do. Maybe Genie returns those tasks somehow for you to wait on them?