Skip to content

Commit

Permalink
test smaller image size
Browse files Browse the repository at this point in the history
  • Loading branch information
danielle-tfh committed Jan 23, 2025
1 parent d11df4b commit 863ac61
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cuda${{ env.CUDA_VERSION }}-nccl${{ env.NCCL_VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cuda-libraries${{ env.CUDA_VERSION }}-nccl${{ env.NCCL_VERSION }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/temp-branch-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Branch - Build and push docker image
on:
push:
branches:
- "add-graceful-shutdown-during-s3-sync"
- "reduce-size-docker-image"

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WORKDIR /src/gpu-iris-mpc
COPY . .
RUN cargo build --release --target x86_64-unknown-linux-gnu --bin nccl --bin server --bin client --bin key-manager --bin upgrade-server --bin upgrade-client --bin upgrade-checker --bin reshare-server --bin reshare-client

FROM --platform=linux/amd64 ghcr.io/worldcoin/iris-mpc-base:cuda12_2-nccl2_22_3_1
FROM --platform=linux/amd64 ghcr.io/worldcoin/iris-mpc-base:cuda-libraries12_2-nccl2_22_3_1

Check warning on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/
ENV DEBIAN_FRONTEND=noninteractive

# Include client, server and key-manager, upgrade-client and upgrade-server binaries
Expand Down
28 changes: 27 additions & 1 deletion Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 ubuntu:22.04 as build-image
FROM --platform=linux/amd64 ubuntu:22.04 as base-image

Check warning on line 1 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 1 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

RUN apt-get update && apt-get install -y pkg-config wget libssl-dev ca-certificates protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -46,3 +46,29 @@ RUN cd /tmp \
--with-nccl=/tmp/nccl/build \
--with-mpi=/opt/amazon/openmpi/ \
&& make && make install


# Runtime Image
FROM --platform=linux/amd64 ubuntu:22.04 as build-image

Check warning on line 52 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 52 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN apt-get update && apt-get install -y pkg-config wget

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
&& dpkg -i cuda-keyring_1.1-1_all.deb \
&& apt-get update \
&& apt-get install -y cuda-libraries-12-2 libnccl2=2.22.3-1+cuda12.2 libnccl-dev=2.22.3-1+cuda12.2 \
&& rm -f cuda-keyring_1.1-1_all.deb

# Set environment variables for runtime
ENV LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:/opt/aws-ofi-nccl/install/lib:/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Check warning on line 63 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
ENV PATH=/opt/aws-ofi-nccl/install/bin:/usr/local/cuda/bin:$PATH

# Copy necessary files from build stage
COPY --from=base-image /opt/gdrcopy /opt/gdrcopy
COPY --from=base-image /opt/aws-ofi-nccl/install /opt/aws-ofi-nccl/install
COPY --from=base-image /opt/amazon/efa /opt/amazon/efa

ENV LD_LIBRARY_PATH=/opt/gdrcopy/lib:/usr/local/cuda/compat:$LD_LIBRARY_PATH
ENV LIBRARY_PATH=/opt/gdrcopy/lib:/usr/local/cuda/compat/:$LIBRARY_PATH

Check warning on line 72 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
ENV CPATH=/opt/gdrcopy/include:$CPATH

Check warning on line 73 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / docker

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$CPATH' (did you mean $PATH?) More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
ENV PATH=/opt/gdrcopy/bin:$PATH

0 comments on commit 863ac61

Please sign in to comment.