Skip to content

Commit 3d47aea

Browse files
committed
ci: Add automatic CI job to build Docker
- Add GHA automated job to build Docker container with latest `main` branch for Torch-TensorRT - Add concurrency control to avoid build clashes - Add environment variables to reduce code duplication, improve readability, and make the code easier to modify when versions change - Add new container registry URL to host built containers
1 parent f7b03f4 commit 3d47aea

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Torch-TRT Docker Build'
2+
3+
# Apply workflow only to main branch
4+
on:
5+
push:
6+
branches: [ main ]
7+
8+
# If pushes to main are made in rapid succession,
9+
# cancel existing docker builds and use newer commits
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: linux.2xlarge
17+
18+
# Define key environment variables
19+
env:
20+
DOCKER_REGISTRY: ghcr.io/pytorch/tensorrt
21+
CONTAINER_NAME: torch_tensorrt_main:latest
22+
TENSORRT_VERSION: 8.6
23+
CUDNN_VERSION: 8.8
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ${{ env.DOCKER_REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build Docker image
37+
env:
38+
DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ env.CONTAINER_NAME }}
39+
run: DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TENSORRT_VERSION --build-arg CUDNN_VERSION=$CUDNN_VERSION -f docker/Dockerfile --tag $DOCKER_TAG .
40+
41+
- name: Push Docker image
42+
env:
43+
DOCKER_URL: ${{ env.DOCKER_REGISTRY }}/${{ env.CONTAINER_NAME }}
44+
run: docker push $DOCKER_URL

0 commit comments

Comments
 (0)