Skip to content

Commit 59a0bf3

Browse files
Feat/add docker build and push to workflows (#142)
* Add docker to dev release workflow * Move Dockerfile to root
1 parent 7ffbf00 commit 59a0bf3

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

.github/workflows/upload-pypi-dev.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Upload Python package to PyPI as dev pre-release
1+
name: Upload Python package to PyPI and build Docker image
22

33
on:
44
workflow_dispatch:
@@ -39,3 +39,29 @@ jobs:
3939
git add pyproject.toml
4040
git commit -m "[fix] bump prerelease version in pyproject.toml"
4141
git push
42+
43+
# Docker build and push section
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v2
46+
47+
- name: Log in to Docker Hub
48+
uses: docker/login-action@v2
49+
with:
50+
username: ${{ secrets.DOCKER_USERNAME }}
51+
password: ${{ secrets.DOCKER_PASSWORD }}
52+
53+
- name: Extract version for tagging Docker image
54+
id: get_version
55+
run: |
56+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
57+
58+
- name: Build and tag Docker image
59+
run: |
60+
docker build \
61+
--build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \
62+
-t your-docker-hub-username/llmstudio:${{ env.VERSION }} \
63+
.
64+
65+
- name: Push Docker image to Docker Hub
66+
run: |
67+
docker push your-docker-hub-username/llmstudio:${{ env.VERSION }}

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# docker/Dockerfile
2+
3+
FROM python:3.11-slim
4+
ENV PYTHONUNBUFFERED=1
5+
6+
# Install tools
7+
RUN apt-get clean && apt-get update
8+
9+
# Install llmstudio
10+
ARG LLMSTUDIO_VERSION
11+
RUN pip install llmstudio==${LLMSTUDIO_VERSION}
12+
RUN pip install psycopg2-binary
13+
14+
# Expose Ports
15+
EXPOSE 8001 8002
16+
17+
CMD ["llmstudio", "server"]

0 commit comments

Comments
 (0)