FROM julia:1.10.4 RUN apt-get update && apt-get install -y python3 python3-pip python3-venv RUN useradd --create-home --shell /bin/bash genie RUN mkdir -p /home/genie/app COPY . /home/genie/app WORKDIR /home/genie/app RUN chown -R genie:genie /home/genie USER genie ## Install youtube transcript api # Install pinecone and other Python dependencies as non-root user RUN python3 -m venv /home/genie/venv && \ /home/genie/venv/bin/pip install youtube-transcript-api # Activate the virtual environment RUN echo 'export PATH="/home/genie/venv/bin:$PATH"' >> /home/genie/.bashrc RUN mkdir -p /home/genie/.julia/config && \ echo 'ENV["PYTHON"] = "/home/genie/venv/bin/python"' >> /home/genie/.julia/config/startup.jl # Create environment variable from secret RUN --mount=type=secret,id=webshareuser,mode=0444,required=true \ echo "export WEBSHAREUSER=$(cat /run/secrets/webshareuser)" >> /home/genie/.bashrc # Create environment variable from secret RUN --mount=type=secret,id=websharepass,mode=0444,required=true \ echo "export WEBSHAREPASS=$(cat /run/secrets/websharepass)" >> /home/genie/.bashrc # Source the .bashrc to make the environment variables available RUN echo 'source /home/genie/.bashrc' >> /home/genie/.profile EXPOSE 8000 EXPOSE 80 ENV JULIA_DEPOT_PATH "/home/genie/.julia" RUN julia -e 'using Pkg; Pkg.activate("."); Pkg.add(["Genie", "Colors", "Stipple"]); Pkg.precompile()' ENTRYPOINT julia --project -e 'using Pkg; Pkg.instantiate(); using Genie; Genie.loadapp(); up(8000, "0.0.0.0", async=false);;'