From f831b5d58bd94888a52c6fbe9325a37a17890cd9 Mon Sep 17 00:00:00 2001 From: diogoazevedo15 Date: Tue, 15 Oct 2024 15:53:30 +0100 Subject: [PATCH 1/2] Add docker to dev release workflow --- .github/workflows/upload-pypi-dev.yml | 29 ++++++++++++++++++++++++++- docker/Dockerfile | 17 ++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile diff --git a/.github/workflows/upload-pypi-dev.yml b/.github/workflows/upload-pypi-dev.yml index 8304eb18..284e07a4 100644 --- a/.github/workflows/upload-pypi-dev.yml +++ b/.github/workflows/upload-pypi-dev.yml @@ -1,4 +1,4 @@ -name: Upload Python package to PyPI as dev pre-release +name: Upload Python package to PyPI and build Docker image on: workflow_dispatch: @@ -39,3 +39,30 @@ jobs: git add pyproject.toml git commit -m "[fix] bump prerelease version in pyproject.toml" git push + + # Docker build and push section + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract version for tagging Docker image + id: get_version + run: | + echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV + + - name: Build and tag Docker image + run: | + docker build \ + --build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \ + -t your-docker-hub-username/llmstudio:${{ env.VERSION }} \ + -f docker/Dockerfile \ + . + + - name: Push Docker image to Docker Hub + run: | + docker push your-docker-hub-username/llmstudio:${{ env.VERSION }} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..c432cf77 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +# docker/Dockerfile + +FROM python:3.11-slim +ENV PYTHONUNBUFFERED=1 + +# Install tools +RUN apt-get clean && apt-get update + +# Install llmstudio +ARG LLMSTUDIO_VERSION +RUN pip install llmstudio==${LLMSTUDIO_VERSION} +RUN pip install psycopg2-binary + +# Expose Ports +EXPOSE 8001 8002 + +CMD ["llmstudio", "server"] From 8a8a79ee01da14322016409e681836ec489182ec Mon Sep 17 00:00:00 2001 From: diogoazevedo15 Date: Tue, 15 Oct 2024 16:07:37 +0100 Subject: [PATCH 2/2] Move Dockerfile to root --- .github/workflows/upload-pypi-dev.yml | 1 - docker/Dockerfile => Dockerfile | 0 2 files changed, 1 deletion(-) rename docker/Dockerfile => Dockerfile (100%) diff --git a/.github/workflows/upload-pypi-dev.yml b/.github/workflows/upload-pypi-dev.yml index 284e07a4..d0040f98 100644 --- a/.github/workflows/upload-pypi-dev.yml +++ b/.github/workflows/upload-pypi-dev.yml @@ -60,7 +60,6 @@ jobs: docker build \ --build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \ -t your-docker-hub-username/llmstudio:${{ env.VERSION }} \ - -f docker/Dockerfile \ . - name: Push Docker image to Docker Hub diff --git a/docker/Dockerfile b/Dockerfile similarity index 100% rename from docker/Dockerfile rename to Dockerfile