2022-01-23 20:57:28 +01:00
|
|
|
# syntax=docker/dockerfile:1
|
2022-07-05 00:01:55 +02:00
|
|
|
FROM continuumio/miniconda3:4.12.0
|
2022-01-23 20:57:28 +01:00
|
|
|
|
2022-01-24 20:08:55 +01:00
|
|
|
# Install system dependencies.
|
2022-01-23 20:57:28 +01:00
|
|
|
RUN apt-get update -y && \
|
|
|
|
apt-get -y install libimage-exiftool-perl
|
|
|
|
|
2022-01-24 20:08:55 +01:00
|
|
|
# Add the local code to the /app directory and set it to be the working directory.
|
|
|
|
# Since we mount the /app directory as a volume in docker-compose.yml, this
|
|
|
|
# allows us to automatically update the code in the Docker image when it's changed.
|
2022-07-04 18:33:55 +02:00
|
|
|
ADD . /app
|
2022-01-24 20:08:55 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Get the arguments from the docker-compose environment.
|
2022-01-24 05:44:38 +01:00
|
|
|
ARG PORT
|
|
|
|
EXPOSE ${PORT}
|
2022-01-23 20:57:28 +01:00
|
|
|
|
2022-01-24 20:08:55 +01:00
|
|
|
# Create the conda environment.
|
2022-01-29 08:41:11 +01:00
|
|
|
RUN conda env create -f config/environment.yml
|
2022-01-23 20:57:28 +01:00
|
|
|
|
2022-01-24 05:44:38 +01:00
|
|
|
# Use the conda environment we created to run the application.
|
2022-07-19 16:26:16 +02:00
|
|
|
# To enable the conda env, we cannot simply RUN `conda activate khoj`,
|
2022-01-24 20:08:55 +01:00
|
|
|
# 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.
|
2022-07-19 16:26:16 +02:00
|
|
|
ENTRYPOINT ["conda", "run", "--no-capture-output", "--name", "khoj", \
|
2022-01-24 05:44:38 +01:00
|
|
|
"python3", "-m", "src.main"]
|