mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Update Dockerfile to use Pip instead of Conda to install application
- Reduce size of app copied to container by adding unneeded directories to .dockerignore. E.g Ignore docs, tests, pip build, dist - Update MANIFEST.ini to include web, emacs interface directories Web directory is used by the web interface which will be exposed by the docker container
This commit is contained in:
parent
7a353066dd
commit
ee65809dc6
3 changed files with 20 additions and 21 deletions
|
@ -1,3 +1,9 @@
|
||||||
.git/
|
.git/
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.venv/
|
||||||
|
docs/
|
||||||
|
tests/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
|
32
Dockerfile
32
Dockerfile
|
@ -1,29 +1,21 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM continuumio/miniconda3:4.12.0
|
FROM python:3.10-slim-bullseye
|
||||||
|
|
||||||
# Install system dependencies.
|
# Install System Dependencies
|
||||||
RUN apt-get update -y && \
|
RUN apt-get update -y && \
|
||||||
apt-get -y install libimage-exiftool-perl
|
apt-get -y install libimage-exiftool-perl
|
||||||
|
|
||||||
# Add the local code to the /app directory and set it to be the working directory.
|
# Copy Application to Container
|
||||||
# Since we mount the /app directory as a volume in docker-compose.yml, this
|
COPY . /app
|
||||||
# allows us to automatically update the code in the Docker image when it's changed.
|
|
||||||
ADD . /app
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Get the arguments from the docker-compose environment.
|
# Install Python Dependencies
|
||||||
|
RUN pip install --upgrade pip && \
|
||||||
|
pip install --upgrade .
|
||||||
|
|
||||||
|
# Run the Application
|
||||||
|
# There are more arguments required for the application to run,
|
||||||
|
# but these should be passed in through the docker-compose.yml file.
|
||||||
ARG PORT
|
ARG PORT
|
||||||
EXPOSE ${PORT}
|
EXPOSE ${PORT}
|
||||||
|
ENTRYPOINT ["khoj"]
|
||||||
# Create the conda environment.
|
|
||||||
RUN conda env create -f config/environment.yml
|
|
||||||
|
|
||||||
# Use the conda environment we created to run the application.
|
|
||||||
# To enable the conda env, we cannot simply RUN `conda activate khoj`,
|
|
||||||
# since each RUN command in a Dockerfile is a separate bash shell.
|
|
||||||
# The environment would not carry forward.
|
|
||||||
# Instead, we'll use `conda run` to run the application.
|
|
||||||
# There are more arguments required for the script to run,
|
|
||||||
# but these should be passed in through the docker-compose.yml file.
|
|
||||||
ENTRYPOINT ["conda", "run", "--no-capture-output", "--name", "khoj", \
|
|
||||||
"python3", "-m", "src.main"]
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
include Readme.md
|
include Readme.md
|
||||||
graft src/interface/web/assets/icons*
|
graft src/interface/*
|
||||||
|
prune src/interface/web/images*
|
||||||
prune docs*
|
prune docs*
|
||||||
global-exclude .DS_Store *.py[cod]
|
global-exclude .DS_Store *.py[cod]
|
Loading…
Reference in a new issue