Skip to content

Commit

Permalink
add docker build files for deepnote
Browse files Browse the repository at this point in the history
  • Loading branch information
liuwen committed Sep 21, 2024
1 parent f37d243 commit 39f7983
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
7 changes: 7 additions & 0 deletions deepnote/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- syncthing. Easily sync files between workstations and containers
- bun. build & run javascript/typescript projects
- basic sys utils. mtr, lsof, nc, screen, etc.

## IN CONSIDERATION
- a separate image with python 3.12 + llamaindex + other LLM dev stuff, of course, with utils.
- image with caddy for more hosting options
53 changes: 53 additions & 0 deletions deepnote/data/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM bitnami/python:3.11-debian-12

# Switch to root user
USER root

# Install system dependencies
RUN apt-get update && apt-get install -y \
vim \
screen \
lsof \
netcat-openbsd \
mtr-tiny \
zsh \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Create necessary directories
RUN mkdir -p /root/work/bin

# Download and install Syncthing
RUN SYNCTHING_VERSION=$(curl -s https://api.github.com/repos/syncthing/syncthing/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') && \
wget https://github.com/syncthing/syncthing/releases/download/${SYNCTHING_VERSION}/syncthing-linux-amd64-${SYNCTHING_VERSION}.tar.gz -O syncthing.tar.gz && \
tar -xzf syncthing.tar.gz && \
mv syncthing-linux-amd64-${SYNCTHING_VERSION}/syncthing /root/work/bin/ && \
rm -rf syncthing-linux-amd64-${SYNCTHING_VERSION} syncthing.tar.gz

# Install Bun
RUN curl -fsSL https://bun.sh/install | bash \
&& mv /root/.bun /root/work/bun

# Set up PATH
ENV PATH="/root/work/bin:/root/work/bun/bin:${PATH}"

# Set working directory
WORKDIR /root/work

# Set up Python virtual environment
RUN python -m venv venv \
&& . venv/bin/activate \
&& rm -rf ~/.cache/pip

# Copy requirements.txt and install Python dependencies
COPY requirements.txt .
RUN . venv/bin/activate && pip install -r requirements.txt

# Set default shell to zsh
SHELL ["/bin/bash", "-c"]

# Activate virtual environment in bash
RUN echo "source /root/work/venv/bin/activate" >> ~/.bashrc

CMD ["/bin/bash"]
6 changes: 6 additions & 0 deletions deepnote/data/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pydantic
httpx
fastapi
pandas
matplotlib
tabulate
63 changes: 63 additions & 0 deletions deepnote/llm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM bitnami/python:3.12-debian-12

# Switch to root user
USER root

# Install system dependencies
RUN apt-get update && apt-get install -y \
vim \
screen \
lsof \
netcat-openbsd \
mtr-tiny \
zsh \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Create necessary directories
RUN mkdir -p /root/work/bin

# Download and install Syncthing
RUN SYNCTHING_VERSION=$(curl -s https://api.github.com/repos/syncthing/syncthing/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') && \
wget https://github.com/syncthing/syncthing/releases/download/${SYNCTHING_VERSION}/syncthing-linux-amd64-${SYNCTHING_VERSION}.tar.gz -O syncthing.tar.gz && \
tar -xzf syncthing.tar.gz && \
mv syncthing-linux-amd64-${SYNCTHING_VERSION}/syncthing /root/work/bin/ && \
rm -rf syncthing-linux-amd64-${SYNCTHING_VERSION} syncthing.tar.gz

# Install Bun
RUN curl -fsSL https://bun.sh/install | bash \
&& mv /root/.bun /root/work/bun

# Set up PATH
ENV PATH="/root/work/bin:/root/work/bun/bin:${PATH}"

# Set working directory
WORKDIR /root/work

# Install HAProxy
RUN curl https://haproxy.debian.net/bernat.debian.org.gpg | gpg --dearmor > /usr/share/keyrings/haproxy.debian.net.gpg && \
echo deb "[signed-by=/usr/share/keyrings/haproxy.debian.net.gpg]" \
http://haproxy.debian.net bookworm-backports-3.0 main \
> /etc/apt/sources.list.d/haproxy.list && \
apt-get update && \
apt-get install -y haproxy=3.0.\* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set up Python virtual environment
RUN python -m venv venv \
&& . venv/bin/activate \
&& rm -rf ~/.cache/pip

# Copy requirements.txt and install Python dependencies
COPY requirements.txt .
RUN . venv/bin/activate && pip install -r requirements.txt

# Set default shell to zsh
SHELL ["/bin/bash", "-c"]

# Activate virtual environment in bash
RUN echo "source /root/work/venv/bin/activate" >> ~/.bashrc

CMD ["/bin/bash"]
3 changes: 3 additions & 0 deletions deepnote/llm/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
llama-index
httpx
fastapi

0 comments on commit 39f7983

Please sign in to comment.