Skip to content

Commit

Permalink
add deepnote image
Browse files Browse the repository at this point in the history
  • Loading branch information
liuwen committed Sep 21, 2024
1 parent e5aa6ab commit 8c809b3
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/deepnote-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Push

on:
push:
branches: [ "main" ]
paths:
- 'deepnote/**'
- '.github/workflows/deepnote-build.yml'
workflow_dispatch: # Allow manual triggering

env:
REGISTRY: ghcr.io
IMAGE_NAME: deepnote-mpdev

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "katbin/source"]
path = katbin/source
url = https://github.com/SphericalKat/katbin
[submodule "one-hub"]
path = one-hub
url = https://github.com/MartialBE/one-hub
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ graph TD
Custom Caddy server with additional modules. See `caddy/README.md` for details.

### Katbin
> only as a showcase for git submodules, not really needed
A pastebin service written in Elixir. See `katbin/README.md` for details. This service is included as a git submodule and built from source.

### opengist

### transfer.sh

### [Other Service]
[Brief description of other service. Add as implemented.]

Expand Down
51 changes: 51 additions & 0 deletions deepnote/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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 up Python virtual environment
RUN python -m venv venv \
&& . venv/bin/activate \
&& rm -rf ~/.cache/pip
ENV PATH="/root/work/venv/bin:${PATH}"

# Copy requirements.txt and install Python dependencies
COPY requirements.txt /root/work/
WORKDIR /root/work

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

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

CMD ["/bin/zsh"]
3 changes: 3 additions & 0 deletions deepnote/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pydantic
httpx
fastapi
2 changes: 1 addition & 1 deletion katbin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ USER nobody
ENV HOME=/app

# Set default environment variables
ENV DATABASE_URL='postgres://postgres:postgres@db:5432/katbin'
ENV DATABASE_URL=postgres://postgres:katbin@db:5432/katbin
ENV SECRET_KEY_BASE='default_secret_key_base_change_me_in_production'
ENV SWOOSH_USERNAME='noreply@katb.in'
ENV SWOOSH_PASSWORD='default_password_change_me'
Expand Down
5 changes: 3 additions & 2 deletions katbin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ services:

katbin:
image: ghcr.io/somehow22/katbin
container_name: katbin
depends_on:
- katbin-db
ports:
- "8080:8080"
- "4000:4000"
env_file:
- .env
networks:
Expand Down Expand Up @@ -71,6 +72,6 @@ networks:
```
Look for any error messages or confirmation that the service has started successfully.

6. Access Katbin at `http://localhost:8080`
6. Access Katbin at `http://localhost:4000`

For more details on Katbin, please refer to the original project: [https://github.com/sphericalkat/katbin](https://github.com/sphericalkat/katbin)
1 change: 1 addition & 0 deletions one-hub
Submodule one-hub added at 7a6488

0 comments on commit 8c809b3

Please sign in to comment.