Skip to content

Commit 9a8be23

Browse files
committed
Sample Docker Push Action
1 parent 6920876 commit 9a8be23

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/docker_builder.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Torch-TRT Docker'
2+
description: 'Build latest Torch-TRT Docker container'
3+
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, ready_for_review, review_requested, reopened]
7+
8+
##### Adapted from https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
9+
10+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-22.04
19+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
20+
permissions:
21+
contents: read
22+
packages: write
23+
#
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
# 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.
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
# 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.
36+
# 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.
37+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
40+
with:
41+
context: .
42+
push: true
43+
tags: torch_tensorrt:main
44+
build-args: |
45+
TENSORRT_VERSION="8.6"
46+
CUDNN_VERSION="8.8"

0 commit comments

Comments
 (0)