-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
0de6465
commit 6f7db85
Showing
1 changed file
with
6 additions
and
22 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,33 +1,17 @@ | ||
# Use Miniconda3 as the base image | ||
FROM continuumio/miniconda3:latest | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.11-slim | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Install system dependencies | ||
RUN apt-get update && \ | ||
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/* | ||
|
||
# Copy the pyproject.toml file and the entire project directory | ||
COPY pyproject.toml . | ||
# Copy the project files to the container | ||
COPY . /app | ||
|
||
# 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 numcodecs -y | ||
|
||
# Install the project and its dependencies | ||
RUN pip install --no-cache-dir -e . | ||
RUN pip install . | ||
|
||
# Expose port 8000 to the outside world | ||
EXPOSE 8000 | ||
|
||
# Set the default command to run when the container starts | ||
CMD ["conda", "run", "--no-capture-output", "-n", "myenv", "python", "api/main.py"] | ||
# Run the application using python main.py | ||
CMD ["python", "api/main.py"] |