Skip to content

Commit b7ccea9

Browse files
authored
Merge pull request #150 from codelion/codelion-patch-1
Update Dockerfile.proxy_only
2 parents 8b4e6fc + 2781c7c commit b7ccea9

File tree

4 files changed

+98
-26
lines changed

4 files changed

+98
-26
lines changed

.github/workflows/publish.yml

Lines changed: 88 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,40 @@ jobs:
3838
steps:
3939
- uses: actions/checkout@v4
4040

41+
# Add aggressive cleanup before any Docker operations
42+
- name: Free disk space
43+
run: |
44+
# Remove large unnecessary packages
45+
sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' 'php.*' azure-cli google-cloud-sdk mongodb-org
46+
sudo apt-get autoremove -y
47+
sudo apt-get clean
48+
49+
# Remove large directories
50+
sudo rm -rf /usr/share/dotnet
51+
sudo rm -rf /usr/local/lib/android
52+
sudo rm -rf /opt/ghc
53+
sudo rm -rf /opt/hostedtoolcache
54+
sudo rm -rf /usr/local/.ghcup
55+
sudo rm -rf /usr/local/share/powershell
56+
sudo rm -rf /usr/local/share/chromium
57+
58+
# Clean Docker
59+
docker system prune -af
60+
docker image prune -af
61+
docker builder prune -af
62+
63+
df -h
64+
4165
- name: Set up QEMU
4266
uses: docker/setup-qemu-action@v3
4367

4468
- name: Set up Docker Buildx
4569
uses: docker/setup-buildx-action@v3
70+
with:
71+
driver-opts: |
72+
image=moby/buildkit:buildx-stable-1
73+
network=host
74+
buildkitd-flags: --debug
4675

4776
- name: Log in to GitHub Container Registry
4877
uses: docker/login-action@v3
@@ -64,29 +93,50 @@ jobs:
6493
type=semver,pattern={{major}}.{{minor}}
6594
type=raw,value=latest
6695
67-
# Build and push proxy image
68-
- name: Build and push proxy_only Docker image
96+
# Build and push proxy AMD64
97+
- name: Build and push proxy_only Docker image AMD64
6998
uses: docker/build-push-action@v5
7099
with:
71100
context: .
72101
file: Dockerfile.proxy_only
73102
push: true
74-
platforms: linux/amd64,linux/arm64
103+
platforms: linux/amd64
75104
tags: ${{ steps.meta-proxy.outputs.tags }}
76105
labels: ${{ steps.meta-proxy.outputs.labels }}
77-
cache-from: type=gha,scope=proxy
78-
cache-to: type=gha,scope=proxy,mode=max
79-
80-
# Add cleanup steps after proxy build
81-
- name: Clean up disk space after proxy build
106+
cache-from: type=gha,scope=proxy-amd64
107+
cache-to: type=gha,scope=proxy-amd64,mode=max
108+
outputs: type=registry,compression=zstd,compression-level=5
109+
110+
# Cleanup after AMD64 build
111+
- name: Cleanup after AMD64 build
112+
run: |
113+
docker system prune -af
114+
docker builder prune -af
115+
df -h
116+
117+
# Build proxy ARM64
118+
- name: Build and push proxy_only Docker image ARM64
119+
uses: docker/build-push-action@v5
120+
with:
121+
context: .
122+
file: Dockerfile.proxy_only
123+
push: true
124+
platforms: linux/arm64
125+
tags: ${{ steps.meta-proxy.outputs.tags }}
126+
labels: ${{ steps.meta-proxy.outputs.labels }}
127+
cache-from: type=gha,scope=proxy-arm64
128+
cache-to: type=gha,scope=proxy-arm64,mode=max
129+
outputs: type=registry,compression=zstd,compression-level=5
130+
131+
# Cleanup after proxy builds
132+
- name: Cleanup after proxy builds
82133
run: |
83-
# Remove all unused docker data including stopped containers, unused networks, dangling images, and build cache
84134
docker system prune -af
85-
# Remove all unused build cache
86135
docker builder prune -af
87-
# Clean only user-owned files in /tmp, ignore permission errors
88136
find /tmp -type f -user $(id -u) -exec rm -f {} + 2>/dev/null || true
137+
df -h
89138
139+
# Extract metadata for full image
90140
- name: Extract metadata for Docker
91141
id: meta
92142
uses: docker/metadata-action@v5
@@ -96,14 +146,36 @@ jobs:
96146
type=semver,pattern={{version}}
97147
type=semver,pattern={{major}}.{{minor}}
98148
latest
99-
100-
- name: Build and push Docker image
149+
150+
# Build full image AMD64
151+
- name: Build and push Docker image AMD64
152+
uses: docker/build-push-action@v5
153+
with:
154+
context: .
155+
push: true
156+
platforms: linux/amd64
157+
tags: ${{ steps.meta.outputs.tags }}
158+
labels: ${{ steps.meta.outputs.labels }}
159+
cache-from: type=gha,scope=full-amd64
160+
cache-to: type=gha,scope=full-amd64,mode=max
161+
outputs: type=registry,compression=zstd,compression-level=5
162+
163+
# Cleanup between architectures
164+
- name: Cleanup between architectures
165+
run: |
166+
docker system prune -af
167+
docker builder prune -af
168+
df -h
169+
170+
# Build full image ARM64
171+
- name: Build and push Docker image ARM64
101172
uses: docker/build-push-action@v5
102173
with:
103174
context: .
104175
push: true
105-
platforms: linux/amd64,linux/arm64
176+
platforms: linux/arm64
106177
tags: ${{ steps.meta.outputs.tags }}
107178
labels: ${{ steps.meta.outputs.labels }}
108-
cache-from: type=gha
109-
cache-to: type=gha,mode=max
179+
cache-from: type=gha,scope=full-arm64
180+
cache-to: type=gha,scope=full-arm64,mode=max
181+
outputs: type=registry,compression=zstd,compression-level=5

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ ENV OPTILLM_PORT=$PORT
1010
WORKDIR /app
1111

1212
# Install system dependencies
13-
RUN --mount=type=cache,target=/var/cache/apt \
14-
--mount=type=cache,target=/var/lib/apt \
15-
apt-get update && apt-get install -y --no-install-recommends \
13+
RUN apt-get update && \
14+
apt-get install -y --no-install-recommends \
1615
build-essential \
1716
python3-dev \
1817
gcc \
1918
g++ \
19+
&& apt-get clean \
2020
&& rm -rf /var/lib/apt/lists/*
2121

2222
# Copy only the requirements file first to leverage Docker cache
@@ -34,10 +34,10 @@ LABEL org.opencontainers.image.description="OptiLLM full image with model servin
3434
LABEL org.opencontainers.image.licenses="Apache-2.0"
3535

3636
# Install curl for the healthcheck
37-
RUN --mount=type=cache,target=/var/cache/apt \
38-
--mount=type=cache,target=/var/lib/apt \
39-
apt-get update && apt-get install -y --no-install-recommends \
37+
RUN apt-get update && \
38+
apt-get install -y --no-install-recommends \
4039
curl \
40+
&& apt-get clean \
4141
&& rm -rf /var/lib/apt/lists/*
4242

4343
# Set working directory

Dockerfile.proxy_only

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ ENV OPTILLM_PORT=$PORT
1010
WORKDIR /app
1111

1212
# Install system dependencies
13-
RUN --mount=type=cache,target=/var/cache/apt \
14-
--mount=type=cache,target=/var/lib/apt \
15-
apt-get update && apt-get install -y --no-install-recommends \
13+
RUN apt-get update && \
14+
apt-get install -y --no-install-recommends \
1615
build-essential \
1716
python3-dev \
1817
gcc \
1918
g++ \
19+
&& apt-get clean \
2020
&& rm -rf /var/lib/apt/lists/*
2121

2222
# Copy only the requirements file first to leverage Docker cache

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="optillm",
5-
version="0.0.34",
5+
version="0.0.35",
66
packages=find_packages(),
77
py_modules=['optillm'],
88
package_data={

0 commit comments

Comments
 (0)