|
1 | 1 | FROM ghcr.io/miguelcarcamov/snow:base |
2 | 2 |
|
3 | | -# Install snow and clean up to minimize image size |
4 | | -RUN python3 --version && \ |
5 | | - pip3 --version && \ |
6 | | - echo "Installing snow" && \ |
7 | | - pip3 install --no-cache-dir git+https://github.com/miguelcarcamov/snow.git && \ |
| 3 | +# Install build tools first (smaller, can be cleaned up separately) |
| 4 | +RUN python3 -m pip install --upgrade --no-cache-dir pip wheel setuptools setuptools-scm build && \ |
| 5 | + python3 -m pip cache purge |
| 6 | + |
| 7 | +# Build and install snow with maximum space efficiency |
| 8 | +# Use /tmp/snow-build which we'll clean up immediately after |
| 9 | +RUN WORKDIR=/tmp/snow-build && \ |
| 10 | + mkdir -p $WORKDIR && \ |
| 11 | + cd $WORKDIR && \ |
| 12 | + echo "Cloning snow repository..." && \ |
| 13 | + git clone --depth 1 --single-branch https://github.com/miguelcarcamov/snow.git . && \ |
| 14 | + echo "Building snow package..." && \ |
| 15 | + python3 -m build --wheel && \ |
| 16 | + echo "Installing snow..." && \ |
| 17 | + pip3 install --no-cache-dir $(ls -t dist/*.whl | head -1) && \ |
| 18 | + cd / && \ |
| 19 | + rm -rf $WORKDIR && \ |
8 | 20 | python3 -m pip cache purge && \ |
9 | | - rm -rf /root/.cache/pip && \ |
| 21 | + rm -rf /root/.cache/pip /root/.cache/pip-tools /root/.cache/git && \ |
10 | 22 | rm -rf /tmp/* /var/tmp/* && \ |
| 23 | + find /usr/local/lib/python3.* -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true && \ |
| 24 | + find /usr/local/lib/python3.* -type f \( -name "*.pyc" -o -name "*.pyo" \) -delete 2>/dev/null || true && \ |
11 | 25 | mkdir -p ~/.casa/data && \ |
12 | 26 | echo "Hello from snow production image" |
13 | 27 | LABEL org.opencontainers.image.source="https://github.com/miguelcarcamov/snow" |
|
0 commit comments