Skip to content

Commit

Permalink
ci: simplified docker build within pypi size limits with pip build an…
Browse files Browse the repository at this point in the history
…d renamed accidentally commited backup file
  • Loading branch information
danellecline committed Jul 19, 2024
1 parent dd2286b commit cfcb581
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 124 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
pip install poetry
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish --build
poetry publish
- name: docker push version
if: steps.semantic.outputs.released == 'true'
Expand All @@ -33,8 +34,8 @@ jobs:
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker buildx create --name mybuilder --platform linux/amd64,linux/arm64 --use
cd docker && \
docker buildx build --push --platform linux/amd64 -t mbari/sdcat:$RELEASE_VERSION-cuda124 --label IMAGE_URI=mbari/sdcat:$RELEASE_VERSION-cuda124 -f Dockerfile.cuda12 .
docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/sdcat:$RELEASE_VERSION --label IMAGE_URI=mbari/sdcat:$RELEASE_VERSION -f Dockerfile .
docker buildx build --push --platform linux/amd64 -t mbari/sdcat:$RELEASE_VERSION-cuda124 --label GIT_VERSION=$RELEASE_VERSION --label IMAGE_URI=mbari/sdcat:$RELEASE_VERSION-cuda124 -f Dockerfile.cuda .
docker buildx build --push --platform linux/amd64,linux/arm64 -t mbari/sdcat:$RELEASE_VERSION --label GIT_VERSION=$RELEASE_VERSION --label IMAGE_URI=mbari/sdcat:$RELEASE_VERSION -f Dockerfile .
push_readme_to_dockerhub:
runs-on: ubuntu-latest
name: Push README to Docker Hub
Expand Down
31 changes: 31 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:22.04

LABEL vendor="MBARI"
LABEL maintainer="[email protected]"
LABEL license="Apache License 2.0"

RUN apt-get update && apt-get install -y \
software-properties-common \
&& apt-get update && apt-get install -y \
python3.11 \
python3.11-dev \
python3.11-distutils \
python3-pip \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ARG GIT_VERSION=latest
ARG IMAGE_URI=mbari/sdcat:${GIT_VERSION}

ENV APP_HOME=/app
ENV PYTHONPATH=${APP_HOME}/sdcat
ENV HF_HOME=/tmp/transformers_cache
WORKDIR ${APP_HOME}
RUN if [ "$GIT_VERSION" != "latest" ]; then \
python3.11 -m pip install sdcat:${GIT_VERSION}; \
else \
python3.11 -m pip install sdcat; \
fi

ENTRYPOINT ["sdcat"]
59 changes: 0 additions & 59 deletions docker/Dockerfile.bak

This file was deleted.

39 changes: 39 additions & 0 deletions docker/Dockerfile.cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04

LABEL vendor="MBARI"
LABEL maintainer="[email protected]"
LABEL license="Apache License 2.0"

RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
wget \
curl \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

ARG GIT_VERSION=latest
ARG IMAGE_URI=mbari/sdcat:${GIT_VERSION}

ENV APP_HOME=/app
ENV PYTHONPATH=${APP_HOME}/sdcat
ENV HF_HOME=/tmp/transformers_cache
WORKDIR ${APP_HOME}
RUN if [ "$GIT_VERSION" != "latest" ]; then \
python3 -m pip install sdcat:${GIT_VERSION}; \
else \
python3 -m pip install sdcat; \
fi

RUN chmod a+rwx ${APP_HOME}
ENV HOME=${APP_HOME}
ENV NUMBA_CACHE_DIR=/tmp
WORKDIR ${APP_HOME}
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
ENTRYPOINT ["sdcat"]
63 changes: 0 additions & 63 deletions docker/Dockerfile.cuda12

This file was deleted.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ readme = "README.md"
packages = [
{ include = "sdcat" }
]
exclude = ["sdcat/tests"]

[tool.poetry.scripts]
sdcat = "sdcat.__main__:cli"
Expand Down

0 comments on commit cfcb581

Please sign in to comment.