-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preliminary sparsify Dockerfile (#234)
* Dockerfile with Workflow files * Upgrade pip * Add empty last line
- Loading branch information
1 parent
3080de7
commit 9e78466
Showing
3 changed files
with
140 additions
and
20 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,72 @@ | ||
name: Build and Publish Sparsify Release Docker Images | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-and-push-docker-image: | ||
name: Build and Push Version Tagged Docker Images to GitHub Container Registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Cleanup disk | ||
run: | | ||
sudo ls -l /usr/local/lib/ | ||
sudo ls -l /usr/share/ | ||
sudo du -sh /usr/local/lib/ | ||
sudo du -sh /usr/share/ | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /usr/share/dotnet | ||
sudo du -sh /usr/local/lib/ | ||
sudo du -sh /usr/share/ | ||
- name: Set up Docker Buildx | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
buildkitd-flags: --debug | ||
|
||
- name: Login to Github Packages | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout code | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Get Tag | ||
id: extract_tag | ||
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF_NAME#*/})" | ||
|
||
- name: Current Version Name | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
run: | | ||
echo ${{ steps.extract_tag.outputs.tag }} | ||
- name: Build and push sparsify release ${{ steps.extract_tag.outputs.tag }} docker image | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./docker | ||
build-args: | | ||
REF=release/${{ steps.extract_tag.outputs.tag }} | ||
push: true | ||
tags: | | ||
ghcr.io/neuralmagic/sparsify:${{ steps.extract_tag.outputs.tag }} | ||
- name: Image digest | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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,58 @@ | ||
name: Build and Publish Sparsify Release Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build-and-push-docker-image: | ||
name: Build and Push Version Tagged Docker Images to GitHub Container Registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Cleanup disk | ||
run: | | ||
sudo ls -l /usr/local/lib/ | ||
sudo ls -l /usr/share/ | ||
sudo du -sh /usr/local/lib/ | ||
sudo du -sh /usr/share/ | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /usr/share/dotnet | ||
sudo du -sh /usr/local/lib/ | ||
sudo du -sh /usr/share/ | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
buildkitd-flags: --debug | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Login to Github Packages | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
- name: Build and push sparsify-nightly docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./docker | ||
build-args: | | ||
REF=main | ||
push: true | ||
tags: | | ||
ghcr.io/neuralmagic/sparsify-nightly:latest | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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 |
---|---|---|
@@ -1,25 +1,15 @@ | ||
# Setup the base image | ||
FROM python:3.8-slim-bullseye | ||
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 | ||
|
||
# Install git | ||
RUN : \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Activate venv | ||
RUN python3.8 -m venv /venv | ||
ENV PATH="venv/bin:$PATH" | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
git python3 python3-dev python3-venv python3-pip python3-wheel build-essential && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install --upgrade setuptools wheel | ||
|
||
# Setup DeepSparse | ||
ARG REF=main | ||
RUN git clone https://github.com/neuralmagic/sparsify && cd sparsify && git checkout $REF | ||
RUN python3 -m pip install --upgrade pip && \ | ||
python3 -m pip install --no-cache-dir -e ./sparsify | ||
|
||
ARG GIT_CHECKOUT | ||
# if $GIT_CHECKOUT is not specified - just install from pypi | ||
RUN if [ -z "${GIT_CHECKOUT}" ] ; then pip3 install --no-cache-dir --upgrade deepsparse[server] ; fi | ||
|
||
# if $GIT_CHECKOUT is specified - clone, checkout $GIT_CHECKOUT, and install with -e | ||
RUN if [ -n "${GIT_CHECKOUT}" ] ; then git clone https://github.com/neuralmagic/deepsparse.git --depth 1 -b $GIT_CHECKOUT; fi | ||
RUN if [ -n "${GIT_CHECKOUT}" ] ; then pip3 install --no-cache-dir --upgrade -e "./deepsparse[server]" ; fi | ||
CMD ["/bin/bash"] |