Skip to content
Merged
Show file tree
Hide file tree
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
51 changes: 3 additions & 48 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,17 @@ concurrency:

env:
RUST_TOOLCHAIN: 1.82.0
CUDA_VERSION: 12.4.1

jobs:
release-docker:
runs-on: buildjet-2vcpu-ubuntu-2204
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

strategy:
matrix:
device-type: [cuda]
include:
- device-type: cuda
image-suffix: ""

steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
Expand Down Expand Up @@ -79,10 +71,8 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Generate image name
env:
IMAGE_SUFFIX: ${{ matrix.image-suffix }}
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}${IMAGE_SUFFIX}" >>${GITHUB_ENV}
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- uses: int128/docker-build-cache-config-action@v1
id: cache
Expand Down Expand Up @@ -110,7 +100,7 @@ jobs:
id: build-and-push
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile.${{ matrix.device-type }}
file: docker/Dockerfile
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -119,41 +109,6 @@ jobs:
cache-to: ${{ steps.cache.outputs.cache-to }}
build-args: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
CUDA_VERSION=${{ env.CUDA_VERSION }}

- name: Docker meta for CUDA 11
if: startsWith(github.ref, 'refs/tags/v')
id: meta-cuda11
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.IMAGE_NAME }}
${{ env.IMAGE_NAME }}
# do not generate tags for latest since cuda12 is the latest
flavor: |
latest=false
suffix=-cuda11
tags: |
type=semver,pattern={{version}}

# Build and push Docker image with Buildx
# Only built on release tags for compatibility with previous versions
- name: Build and push Docker image for CUDA 11
if: startsWith(github.ref, 'refs/tags/v')
id: build-and-push-cuda11
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile.${{ matrix.device-type }}
push: true
context: .
tags: ${{ steps.meta-cuda11.outputs.tags }}
labels: ${{ steps.meta-cuda11.outputs.labels }}
cache-from: ${{ steps.cache.outputs.cache-from }}
cache-to: ${{ steps.cache.outputs.cache-to }}
build-args: |
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
CUDA_VERSION=11.7.1


- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
Expand Down
59 changes: 59 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
ARG BASE_CONTAINER_BUILD=rust:1-bullseye
ARG BASE_CONTAINER=ubuntu:22.04

FROM ${BASE_CONTAINER_BUILD} AS build

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
pkg-config \
libssl-dev \
protobuf-compiler \
git \
cmake \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /root/workspace

RUN mkdir -p /opt/tabby/bin
RUN mkdir -p /opt/tabby/lib
RUN mkdir -p target

COPY . .

RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/root/workspace/target \
cargo build --no-default-features --features prod --release --package tabby && \
cp target/release/tabby /opt/tabby/bin/

FROM ${BASE_CONTAINER} AS runtime

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
curl \
unzip \
openssh-client \
ca-certificates \
libgomp1 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Disable safe directory in docker
# Context: https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
RUN git config --system --add safe.directory "*"

# Automatic platform ARGs in the global scope
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETARCH

COPY --from=build /opt/tabby /opt/tabby

ENV PATH="$PATH:/opt/tabby/bin"
ENV TABBY_ROOT=/data

ENTRYPOINT ["/opt/tabby/bin/tabby"]
90 changes: 0 additions & 90 deletions docker/Dockerfile.cuda

This file was deleted.

77 changes: 0 additions & 77 deletions docker/Dockerfile.rocm

This file was deleted.

Loading