Skip to content

Commit 93bf2ea

Browse files
authored
Fix docker build action (#415)
1 parent fbf6c96 commit 93bf2ea

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

.github/workflows/docker.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
ref:
1111
description: 'The git ref (branch or tag) to build the Docker image from.'
1212
required: true
13+
version:
14+
description: 'Version tag for the Docker image (e.g., 0.3.3)'
15+
required: true
1316

1417
env:
1518
REGISTRY: ghcr.io
@@ -28,6 +31,9 @@ jobs:
2831
steps:
2932
- name: Checkout repository
3033
uses: actions/checkout@v5
34+
with:
35+
ref: ${{ github.event.inputs.ref || github.ref }}
36+
path: trinity-${{ github.run_id }}
3137
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
3238
- name: Log in to the Container registry
3339
uses: docker/login-action@v2
@@ -42,18 +48,20 @@ jobs:
4248
with:
4349
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4450
tags: |
45-
type=match,pattern=\d.\d.\d
46-
type=sha
51+
type=match,pattern=\d.\d.\d,enable=${{ github.event_name == 'release' }}
52+
type=sha,enable=${{ github.event_name == 'release' }}
53+
type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
54+
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
4755
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
4856
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
4957
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
5058
- name: Build and push Docker image
5159
id: push
5260
uses: docker/build-push-action@v4
5361
with:
54-
context: .
62+
context: trinity-${{ github.run_id }}
5563
push: true
56-
file: scripts/docker/Dockerfile
64+
file: trinity-${{ github.run_id }}/scripts/docker/Dockerfile
5765
shm-size: 64g
5866
tags: ${{ steps.meta.outputs.tags }}
5967
labels: ${{ steps.meta.outputs.labels }}
@@ -65,3 +73,8 @@ jobs:
6573
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
6674
subject-digest: ${{ steps.push.outputs.digest }}
6775
push-to-registry: true
76+
77+
- name: Cleanup workspace
78+
if: always()
79+
run: |
80+
sudo rm -rf trinity-${{ github.run_id }} 2>/dev/null

scripts/docker/Dockerfile.uv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RUN . /opt/venv/bin/activate && \
4040

4141
# Install flash_attn and Megatron
4242
RUN . /opt/venv/bin/activate && \
43-
uv pip install -e.[flash_attn] && \
43+
uv pip install flash_attn==2.8.1 --no-deps --no-cache-dir && \
4444
uv pip install -e .[megatron] && \
4545
NVCC_APPEND_FLAGS="--threads 4" APEX_PARALLEL_BUILD=8 \
4646
uv pip install -v --no-build-isolation \

0 commit comments

Comments
 (0)