Skip to content

Commit 71de060

Browse files
author
Mathieu Bour
committed
fix: rewrite flavors support
1 parent cf93e31 commit 71de060

3 files changed

Lines changed: 37 additions & 28 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
include:
20-
- target: base
20+
- target: single
21+
latest: true
2122
suffix: ''
2223
- target: parallel
23-
suffix: parallel
24+
latest: false
25+
suffix: -parallel
2426
steps:
2527
- name: Checkout
2628
uses: actions/checkout@v2
@@ -37,20 +39,22 @@ jobs:
3739
uses: docker/metadata-action@v3
3840
with:
3941
images: csquareai/ml-default
42+
flavor: |
43+
latest=${{ matrix.latest }}
44+
prefix=
45+
suffix=${{ matrix.suffix }}
4046
tags: |
41-
type=schedule,suffix=${{ matrix.suffix }}
42-
type=ref,event=branch,suffix=${{ matrix.suffix }}
43-
type=ref,event=pr,suffix=${{ matrix.suffix }}
44-
type=semver,pattern={{version}},suffix=${{ matrix.suffix }}
45-
type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.suffix }}
46-
type=semver,pattern={{major}},suffix=${{ matrix.suffix }}
47-
type=sha,suffix=${{ matrix.suffix }}
47+
type=schedule
48+
type=edge,branch=main
49+
type=semver,pattern={{version}}
50+
type=semver,pattern={{major}}.{{minor}}
51+
type=semver,pattern={{major}}
52+
type=sha
4853
- name: Build and push image to DockerHub
4954
uses: docker/build-push-action@v2
5055
with:
5156
context: .
5257
target: ${{ matrix.target }}
5358
push: ${{ github.event_name != 'pull_request' }}
5459
tags: ${{ steps.meta.outputs.tags }}
55-
# build-args: ${{ }}
5660
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,7 @@ ARG commit_hash=unknown
66
ARG version=unknown
77

88
# Labels, see http://label-schema.org/rc1/
9-
LABEL maintainer="sicong@csquare.ai"
10-
LABEL org.label-schema.schema-version="1.0"
11-
LABEL org.label-schema.build-date="$build_date"
12-
LABEL org.label-schema.name="ml-default:single"
13-
LABEL org.label-schema.description="Default Docker image used to run experiments on csquare.run"
14-
LABEL org.label-schema.url="https://hub.docker.com/r/csquareai/ml-default"
15-
LABEL org.label-schema.vcs-url="https://github.com/csquare-ai/ml-default"
16-
LABEL org.label-schema.vcs-ref="$commit_hash"
17-
LABEL org.label-schema.version="$version"
18-
LABEL org.label-schema.vendor="Cohesive Computing SA"
9+
LABEL maintainer="engineering@csquare.ai"
1910

2011
# Python 3.7 is supported by Ubuntu Bionic out of the box
2112
ENV PYTHON_VERSION=3.7
@@ -66,6 +57,17 @@ RUN curl --silent https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \
6657
# Install common Python dependencies
6758
RUN pip install tqdm dvc future typing packaging h5py
6859

60+
WORKDIR "/"
61+
62+
63+
# Single node support
64+
# -------------------
65+
# Install the most famous frameworks
66+
# - TensorFlow
67+
# - PyTorch with torchvision
68+
# - MXNet
69+
FROM base as single
70+
6971
# Install TensorFlow and Keras
7072
RUN pip install tensorflow==${TENSORFLOW_VERSION} keras
7173

@@ -77,12 +79,12 @@ RUN PYTAGS=$(python -c "from packaging import tags; tag = list(tags.sys_tags())[
7779
# Install MXNet
7880
RUN pip install mxnet-cu101==${MXNET_VERSION}
7981

80-
WORKDIR "/"
81-
82-
# Multi-node support enriched with OpenMPI and Horovod
83-
FROM base as parallel
84-
85-
LABEL org.label-schema.name="ml-default:parallel"
82+
# Multi-node support
83+
# ------------------
84+
# Install MPI-capable librairies
85+
# - OpenMPI
86+
# - Horovod
87+
FROM single as parallel
8688

8789
# Enable GLOO
8890
ENV HOROVOD_WITH_GLOO=1

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727
"scripts": {
2828
"format": "prettier --write \"**\"",
2929
"format:check": "prettier --check \"**\"",
30-
"build:base": "docker build --tag=csquareai/ml-default:base --target=base --build-arg=build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg=commit_hash=$(git rev-parse --short HEAD) --build-arg=version=$(jq -r .version package.json) .",
31-
"build:parallel": "docker build --tag=csquareai/ml-default:parallel --target=parallel --build-arg=build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg=commit_hash=$(git rev-parse --short HEAD) --build-arg=version=$(jq -r .version package.json) ."
30+
"build:base": "docker build --tag=csquareai/ml-default:base --target=base .",
31+
"build:single": "docker build --tag=csquareai/ml-default:single --target=single .",
32+
"build:parallel": "docker build --tag=csquareai/ml-default:parallel --target=parallel ."
33+
},
34+
"dependencies": {
3235
},
3336
"devDependencies": {
3437
"@csquare/prettier-config": "^1.1.2",

0 commit comments

Comments
 (0)