misinfo_detection_app / Dockerfile
stefanjwojcik's picture
first commit
9ff0a35 verified
raw
history blame
1.43 kB
FROM julia:1.10.4
# Install python requirements for the project as root
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv
# Create a non-root user
RUN useradd --create-home --shell /bin/bash user
RUN mkdir /home/user/app
WORKDIR /home/user/app
RUN chown -R user:user /home/
USER user
# Copy only the requirements file to leverage Docker cache
COPY --chown=user requirements.txt /home/user/app/requirements.txt
# Install pinecone and other Python dependencies as non-root user
RUN python3 -m venv /home/user/venv && \
/home/user/venv/bin/pip install -r /home/user/app/requirements.txt
# Copy the rest of the application code
COPY --chown=user . /home/user/app
# Copy the data to the container
COPY --chown=user data /home/user/data
# Activate the virtual environment
RUN echo 'export PATH="/home/user/venv/bin:$PATH"' >> /home/user/.bashrc
RUN mkdir -p /home/user/.julia/config && \
echo 'ENV["PYTHON"] = "/home/user/venv/bin/python"' >> /home/user/.julia/config/startup.jl
RUN mkdir -p /home/user/.julia/config
#COPY startup.jl /home/user/.julia/config/startup.jl
# Ensure the virtual environment is activated
RUN /home/user/venv/bin/pip install --upgrade pip
# Expose the port
EXPOSE 8000
EXPOSE 80
ENV JULIA_DEPOT_PATH "/home/user/.julia"
RUN julia -e 'using Pkg; Pkg.activate("."); Pkg.precompile()'
ENTRYPOINT julia --project -e 'using Pkg; Pkg.instantiate(); include("server.jl")'