Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

[Docker file changes] -> Merged install dependencies and miniforge to… #47

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Use the official Ubuntu image as a parent image
FROM python:3.12-slim
# Use the official slim Python image as a base
FROM python:3.11-slim

# Set environment variables
ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="/opt/conda/bin:$PATH"

# Install system dependencies including wget, curl, and bzip2
# Install system dependencies and Miniforge directly without keeping cache
RUN apt-get update && apt-get install -y \
gcc \
g++ \
Expand All @@ -14,12 +15,10 @@ RUN apt-get update && apt-get install -y \
wget \
bzip2 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install Miniforge
RUN curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \
bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opt/conda && \
rm Miniforge3-$(uname)-$(uname -m).sh
&& rm -rf /var/lib/apt/lists/* \
&& curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" \
&& bash Miniforge3-Linux-x86_64.sh -b -p /opt/conda \
&& rm Miniforge3-Linux-x86_64.sh

# Add Conda to the PATH environment variable
ENV PATH="/opt/conda/bin:$PATH"
Expand All @@ -29,13 +28,12 @@ WORKDIR /app

# Copy the environment.yml and requirements.txt files to the working directory
COPY environment.yml /app/environment.yml
COPY requirements.txt /app/requirements.txt

# Create a Conda environment using Mamba and install Python packages from environment.yml
RUN mamba env create -f /app/environment.yml

# Activate the environment for subsequent commands
SHELL ["mamba", "run", "-n", "myenv", "/bin/bash", "-c"]
# Change to use Bash and activate the environment
SHELL ["/bin/bash", "-c"]

# Install pip packages from requirements.txt
# RUN pip install -r /app/requirements.txt
Expand All @@ -46,5 +44,5 @@ COPY . /app
# Expose ports
EXPOSE 5001

# Set the default command to run Streamlit
CMD ["mamba", "run", "-n", "myenv", "streamlit", "run", "app.py", "--server.port=5001"]
# Run the app using the environment's Streamlit
CMD ["bash", "-c", "source activate myenv && streamlit run app.py --server.port=5001"]