File tree Expand file tree Collapse file tree 3 files changed +90
-0
lines changed
Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Build and Push
2+
3+ on :
4+ workflow_run :
5+ workflows : ["Publish to PyPI.org"]
6+ types :
7+ - completed
8+
9+ jobs :
10+ docker :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v4
15+
16+ - name : Set up QEMU
17+ uses : docker/setup-qemu-action@v3
18+
19+ - name : Set up Docker Buildx
20+ uses : docker/setup-buildx-action@v3
21+
22+ - name : Login to Docker Hub
23+ uses : docker/login-action@v3
24+ with :
25+ username : ${{ secrets.DOCKERHUB_USERNAME }}
26+ password : ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+ - name : Build and push
29+ uses : docker/build-push-action@v5
30+ with :
31+ context : ./docker/serving
32+ platforms : linux/amd64
33+ push : true
34+ tags : ${{ secrets.DOCKERHUB_TAG }}
Original file line number Diff line number Diff line change 1+ FROM python:3.11-slim-bookworm
2+
3+ # ######## Setup system
4+
5+ RUN mkdir /workspace && mkdir /workspace/transformers_cache
6+ WORKDIR /workspace
7+
8+ ENV HF_HOME /workspace/transformers_cache
9+
10+ # ######## Install system dependencies
11+ RUN apt update && apt install -y git bash curl wget libxml2
12+
13+ # Install ssh server, remove all pre-generated ssh host keys, and disable password auth
14+ RUN apt install -y openssh-server && \
15+ rm -f /etc/ssh/ssh_host_* && \
16+ sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
17+
18+ # Install CUDA (for FlashAttention 2)
19+ RUN wget -q --show-progress --progress=bar:force:noscroll -O cuda_installer https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run && \
20+ chmod +x cuda_installer && \
21+ ./cuda_installer --silent --toolkit --override && \
22+ rm -f cuda_installer
23+
24+ # ######## Install OpenChat
25+ # Install OpenChat
26+ RUN pip3 install ninja packaging torch
27+ RUN pip3 install ochat
28+
29+ # ######## Install Cloudflared
30+ RUN wget -q --show-progress --progress=bar:force:noscroll -O /cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /cloudflared
31+
32+ # ######## Startup script
33+
34+ COPY start.sh /start.sh
35+ ENTRYPOINT ["/start.sh" ]
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # start ssh server
4+ if [ -n " $PUBLIC_KEY " ]; then
5+ mkdir -p ~ /.ssh
6+ echo " $PUBLIC_KEY " >> ~ /.ssh/authorized_keys
7+ chmod 700 -R ~ /.ssh
8+
9+ dpkg-reconfigure openssh-server # generate ssh keys
10+ service ssh start
11+ fi
12+
13+ # start cloudflare tunnel
14+ if [ -n " $CLOUDFLARED_TUNNEL_ARGS " ]; then
15+ /cloudflared $CLOUDFLARED_TUNNEL_ARGS &
16+ fi
17+
18+ # start openchat server
19+ python3 -m ochat.serving.openai_api_server --model $MODEL --host 127.0.0.1 --port 18888 --engine-use-ray --worker-use-ray --disable-log-requests --disable-log-stats $ARGS &
20+
21+ wait
You can’t perform that action at this time.
0 commit comments