Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #47

Open
BlessedTatonka opened this issue Nov 29, 2024 · 0 comments
Open

Dockerfile #47

BlessedTatonka opened this issue Nov 29, 2024 · 0 comments

Comments

@BlessedTatonka
Copy link

If anyone is struggling with installing old dependencies (as I was 😊), here is the Dockerfile contents to ensure a successful start:

# Use the official Python 3.7 image as a base
FROM python:3.7-slim

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

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    wget \
    curl \
    git \
    sudo \
    libgl1-mesa-glx \
    libcairo2-dev \
    libffi-dev \
    libssl-dev \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Miniconda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /miniconda.sh && \
    bash /miniconda.sh -b -p /opt/conda && \
    rm /miniconda.sh && \
    /opt/conda/bin/conda clean --all -y

# Set Conda environment as default
RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
SHELL ["/bin/bash", "-c"]

# Clone the DeepSVG repository
WORKDIR /app
RUN git clone https://github.com/alexandre01/deepsvg.git

# Update requirements.txt to replace sklearn with scikit-learn
WORKDIR /app/deepsvg
RUN sed -i 's/^sklearn$/scikit-learn/' requirements.txt

# Set up the Conda environment and install dependencies
RUN conda create -n deepsvg python=3.7 -y && \
    echo "conda activate deepsvg" >> ~/.bashrc && \
    source ~/.bashrc && \
    pip install --no-cache-dir -r requirements.txt

# Optional: Set up cairosvg dependencies for specific platforms
RUN if [ "$(uname -s)" = "Linux" ]; then \
        apt-get update && apt-get install -y --no-install-recommends libcairo2-dev; \
    fi

# Default entrypoint to activate the environment and start the container in a shell
CMD ["/bin/bash", "-c", "source ~/.bashrc && conda activate deepsvg && bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant