File tree Expand file tree Collapse file tree 5 files changed +48
-16
lines changed Expand file tree Collapse file tree 5 files changed +48
-16
lines changed Original file line number Diff line number Diff line change 1
- name : Docker Container
1
+ name : Publish Docker Containers
2
2
3
3
on :
4
4
push :
@@ -10,18 +10,33 @@ jobs:
10
10
build :
11
11
runs-on : ubuntu-18.04
12
12
steps :
13
+ - name : Setup Python
14
+ uses : actions/setup-python@v2
15
+ with :
16
+ python-version : 3.8
17
+ architecture : x64
13
18
- name : Checkout TorchX
14
19
uses : actions/checkout@v2
20
+ - name : Get TorchX version
21
+ run : |
22
+ set -eux
23
+ python setup.py install
24
+ echo "VERSION=$(python -c 'import torchx; print(torchx.__version__)')" >> $GITHUB_ENV
15
25
- name : Configure Docker
16
- env :
17
- AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
18
- AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19
26
run : |
20
27
set -eux
21
- aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 495572122715.dkr.ecr.us-west-2.amazonaws.com
22
- - name : Build container
23
- run : torchx/runtime/container/build.sh
24
- - name : Tag container
25
- run : docker tag torchx ${{secrets.TORCHX_CONTAINER_REPO}}:latest
26
- - name : Push container
27
- run : docker push ${{secrets.TORCHX_CONTAINER_REPO}}:latest
28
+ echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
29
+ - name : Build torchx container
30
+ run : |
31
+ set -eux
32
+ torchx/runtime/container/build.sh
33
+ docker tag torchx "ghcr.io/pytorch/torchx:$VERSION"
34
+ - name : Build examples container
35
+ run : |
36
+ set -eux
37
+ docker build -t "ghcr.io/pytorch/torchx-examples:$VERSION" examples/apps/
38
+ - name : Push containers
39
+ run : |
40
+ set -eux
41
+ docker push "ghcr.io/pytorch/torchx-examples:$VERSION"
42
+ docker push "ghcr.io/pytorch/torchx:$VERSION"
Original file line number Diff line number Diff line change 32
32
# docker containers. We have one container for the example apps and one for
33
33
# the standard built in apps. If you modify the torchx example code you'll
34
34
# need to rebuild the container before launching it on KFP
35
+
36
+ from torchx .version import TORCHX_IMAGE , EXAMPLES_IMAGE
37
+
35
38
parser .add_argument (
36
39
"--image" ,
37
40
type = str ,
38
- help = "docker image to use" ,
39
- default = "495572122715.dkr.ecr.us-west-2.amazonaws.com/torchx/examples:latest" ,
41
+ help = "docker image to use for the examples apps " ,
42
+ default = EXAMPLES_IMAGE ,
40
43
)
41
44
parser .add_argument (
42
45
"--torchx_image" ,
43
46
type = str ,
44
- help = "docker image to use" ,
45
- default = "495572122715.dkr.ecr.us-west-2.amazonaws.com/torchx:latest" ,
47
+ help = "docker image to use for the builtin torchx apps " ,
48
+ default = TORCHX_IMAGE ,
46
49
)
47
50
48
51
# %%
Original file line number Diff line number Diff line change 7
7
from typing import Dict , Optional
8
8
9
9
import torchx .specs as specs
10
+ from torchx .version import TORCHX_IMAGE
10
11
11
12
12
13
def torchserve (
13
14
model_path : str ,
14
15
management_api : str ,
15
- image : str = "495572122715.dkr.ecr.us-west-2.amazonaws.com/torchx:latest" ,
16
+ image : str = TORCHX_IMAGE ,
16
17
params : Optional [Dict [str , object ]] = None ,
17
18
) -> specs .AppDef :
18
19
"""Deploys the provided model to the given torchserve management API
Original file line number Diff line number Diff line change @@ -13,3 +13,11 @@ def test_can_get_version(self) -> None:
13
13
import torchx
14
14
15
15
self .assertIsNotNone (torchx .__version__ )
16
+
17
+ def test_images (self ) -> None :
18
+ from torchx .version import __version__ , TORCHX_IMAGE , EXAMPLES_IMAGE
19
+
20
+ self .assertEqual (TORCHX_IMAGE , f"ghcr.io/pytorch/torchx:{ __version__ } " )
21
+ self .assertEqual (
22
+ EXAMPLES_IMAGE , f"ghcr.io/pytorch/torchx-examples:{ __version__ } "
23
+ )
Original file line number Diff line number Diff line change 15
15
# 0.1.0rcN # Release Candidate
16
16
# 0.1.0 # Final release
17
17
__version__ = "0.1.0.dev0"
18
+
19
+ # Use the github container registry images corresponding to the current package
20
+ # version.
21
+ TORCHX_IMAGE = f"ghcr.io/pytorch/torchx:{ __version__ } "
22
+ EXAMPLES_IMAGE = f"ghcr.io/pytorch/torchx-examples:{ __version__ } "
You can’t perform that action at this time.
0 commit comments