-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Containerize Boltz, add CI workflows
Add docker files and github workflows for automated docker image builds. Builds images with tags: main (python:3.10-slim), cuda12-1, and cuda12-4. Commit summaries containing "[no-ci]" will skip builds, and CI only runs with changes to core files. Have a good day.
- Loading branch information
Showing
5 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Dockerfile | ||
.git | ||
.gitignore | ||
.dockerignore | ||
.vscode | ||
.DS_STORE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build and push base docker image | ||
|
||
on: | ||
push: | ||
branches: ["release"] | ||
paths: | ||
- "Dockerfile" | ||
- "scripts/**" | ||
- "src/**" | ||
- "pyproject.toml" | ||
pull_request: | ||
branches: ["release"] | ||
paths: | ||
- "Dockerfile" | ||
- "scripts/**" | ||
- "src/**" | ||
- "pyproject.toml" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-push-base: | ||
if: "!contains(github.event.head_commit.message, '[no-ci]')" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main | ||
build-args: BASE_IMAGE=python:3.10-slim | ||
# cache-from: type=gha | ||
# cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build and push CUDA 12.1 docker image | ||
|
||
on: | ||
push: | ||
branches: ["release"] | ||
paths: | ||
- "Dockerfile" | ||
- "scripts/**" | ||
- "src/**" | ||
- "pyproject.toml" | ||
pull_request: | ||
branches: ["release"] | ||
paths: | ||
- "Dockerfile" | ||
- "scripts/**" | ||
- "src/**" | ||
- "pyproject.toml" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-push-cuda12-1: | ||
if: "!contains(github.event.head_commit.message, '[no-ci]')" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cuda12-1 | ||
build-args: BASE_IMAGE=nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 | ||
# cache-from: type=gha | ||
# cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build and push CUDA 12.4 docker image | ||
|
||
on: | ||
push: | ||
branches: ["release"] | ||
paths: | ||
- "Dockerfile" | ||
- "scripts/**" | ||
- "src/**" | ||
- "pyproject.toml" | ||
pull_request: | ||
branches: ["release"] | ||
paths: | ||
- "Dockerfile" | ||
- "scripts/**" | ||
- "src/**" | ||
- "pyproject.toml" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-push-cuda12-4: | ||
if: "!contains(github.event.head_commit.message, '[no-ci]')" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Convert repository name to lowercase | ||
run: echo "IMAGE_NAME=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cuda12-4 | ||
build-args: BASE_IMAGE=nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 | ||
# cache-from: type=gha | ||
# cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} AS builder | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
build-essential \ | ||
python3 \ | ||
python3-venv \ | ||
python3-dev \ | ||
&& python3 -m venv /opt/venv \ | ||
&& . /opt/venv/bin/activate \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& pip install --no-cache-dir boltz \ | ||
&& apt-get purge -y git build-essential \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
FROM ${BASE_IMAGE} | ||
|
||
COPY --from=builder /opt/venv /opt/venv | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
python3 \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" \ | ||
LANG=C.UTF-8 \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
ARG USERNAME=boltz | ||
ARG UID=900 | ||
ARG GID=900 | ||
RUN groupadd --gid $GID $USERNAME && \ | ||
useradd --uid $UID --gid $GID --create-home --shell /bin/bash $USERNAME | ||
|
||
WORKDIR /app | ||
|
||
COPY LICENSE /app/LICENSE | ||
COPY README.md /app/README.md | ||
COPY examples /app/examples | ||
COPY scripts /app/scripts | ||
COPY docs /app/docs | ||
|
||
RUN chown -R $USERNAME:$USERNAME /app | ||
|
||
USER $USERNAME | ||
|
||
ENTRYPOINT ["boltz"] |