-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fc13e7
commit cd14498
Showing
1 changed file
with
18 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,36 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.11-slim | ||
# Use Miniconda3 as the base image | ||
FROM continuumio/miniconda3:latest | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install git unzip g++ gcc libgeos++-dev libproj-dev proj-data proj-bin -y | ||
apt-get install -y git unzip g++ gcc libgeos++-dev libproj-dev proj-data proj-bin && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN apt-get update && \ | ||
apt-get install git unzip g++ gcc libgeos++-dev libproj-dev proj-data proj-bin -y | ||
|
||
# Copy the pyproject.toml file | ||
# Copy the pyproject.toml file and the entire project directory | ||
COPY pyproject.toml . | ||
|
||
# Copy the entire project directory | ||
COPY . /app | ||
|
||
# Install requirements | ||
RUN conda install python=3.12 | ||
# Create a new conda environment | ||
RUN conda create -n myenv python=3.12 -y | ||
|
||
# Activate the conda environment | ||
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"] | ||
|
||
# Install conda packages | ||
RUN conda install -c conda-forge xesmf esmpy h5py pytorch-cpu=2.3.1 torchvision -y | ||
|
||
# Install PyTorch with pip | ||
RUN pip install torch==2.3.1 torchvision --index-url https://download.pytorch.org/whl/cpu | ||
|
||
# Install build dependencies and the project | ||
# Install the project and its dependencies | ||
RUN pip install --no-cache-dir -e . | ||
|
||
# Expose port 8000 to the outside world | ||
EXPOSE 8000 | ||
|
||
# Run the application using python main.py | ||
CMD ["python", "api/main.py"] | ||
# Set the default command to run when the container starts | ||
CMD ["conda", "run", "--no-capture-output", "-n", "myenv", "python", "api/main.py"] |