I’m building a Docker image with a precompile statement in its Dockerfile to make startup faster. If I deploy the image on the same machine where it was built, it starts up very quick. However, If I deploy to a different machine, the precompilation runs again whenever the container is started.
I suppose the precompile cache is invalidated due to the machine change, even if they share the same architecture. Does anyone know how to solve this?
Here’s an example of the type of app I’m trying to deploy
and its Dockerfile
FROM julia:latest
RUN apt-get update && apt-get install -y vim
RUN useradd --create-home --shell /bin/bash genie
RUN mkdir /home/genie/app
COPY . /home/genie/app
WORKDIR /home/genie/app
RUN chown -R genie:genie /home/
USER genie
EXPOSE 8000
EXPOSE 80
ENV JULIA_DEPOT_PATH "/home/genie/.julia"
ENV JULIA_REVISE = "off"
ENV GENIE_ENV "prod"
ENV GENIE_HOST "0.0.0.0"
ENV PORT "8000"
ENV WSPORT "8000"
ENV EARLYBIND "true"
RUN julia -e "using Pkg; Pkg.activate(\".\"); Pkg.instantiate(); Pkg.precompile(); "
ENTRYPOINT ["julia", "--project", "-e", "using GenieFramework; Genie.loadapp(); up(async=false);"]