Skip to content

Commit d2e4961

Browse files
committed
Sample Docker Push Action
1 parent 6920876 commit d2e4961

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/docker_builder.yml

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

0 commit comments

Comments
 (0)