Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor GitHub Actions release workflow and Dockerfile #494

Merged
merged 6 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 0 additions & 111 deletions .github/workflows/publish.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release packages and images

on:
workflow_dispatch:
release:
types:
- published
- edited

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

docker:
strategy:
matrix:
cml: [0]
dvc: [1, 2]
gpu: [false, true]
base: [0, 1]
include:
- base: 0
cuda: 10.1
cudnn: 7
python: 2.7
ubuntu: 18.04
- base: 1
cuda: 11.0.3
cudnn: 8
python: 3.8
ubuntu: 20.04
casperdcl marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
needs: package

steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/build-push-action@v2
if: matrix.gpu == false
with:
push: true
context: ./
file: ./Dockerfile
tags:
dvcorg/cml:${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{
matrix.base }}
build-args: |
CML_VERSION=${{ matrix.cml }}
DVC_VERSION=${{ matrix.dvc }}
PYTHON_VERSION=${{ matrix.python }}
BASE_IMAGE=ubuntu:${{ matrix.ubuntu }}
casperdcl marked this conversation as resolved.
Show resolved Hide resolved

- uses: docker/build-push-action@v2
if: matrix.gpu == true
with:
push: true
context: ./
file: ./Dockerfile
tags:
dvcorg/cml:${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{
matrix.base }}-gpu
build-args: |
CML_VERSION=${{ matrix.cml }}
DVC_VERSION=${{ matrix.dvc }}
PYTHON_VERSION=${{ matrix.python }}
BASE_IMAGE=nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }}
104 changes: 104 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
ARG BASE_IMAGE=ubuntu:20.04
FROM ${BASE_IMAGE}

# TODO: consider using iterative.ai or something else
LABEL maintainer="dvcorg <[email protected]>"

# CONFIGURE NON-INTERACTIVE APT
ENV DEBIAN_FRONTEND=noninteractive
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90assumeyes

# CONFIGURE SHELL
SHELL ["/bin/bash", "-c"]

# INSTALL CORE DEPENDENCIES
RUN apt-get update \
&& apt-get install --no-install-recommends \
build-essential \
apt-utils \
apt-transport-https \
ca-certificates \
software-properties-common \
pkg-config \
curl \
wget \
unzip \
gpg-agent \
sudo \
tzdata \
locales \
&& locale-gen en_US.UTF-8 \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

# CONFIGURE LOCALE
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en"
ENV LC_ALL="en_US.UTF-8"

# INSTALL NODE, GIT & GO
RUN add-apt-repository ppa:git-core/ppa --yes \
&& add-apt-repository ppa:longsleep/golang-backports --yes \
&& curl --location https://deb.nodesource.com/setup_12.x | bash \
&& apt-get update \
&& apt-get install --yes git golang-go nodejs \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

# INSTALL TERRAFORM
RUN curl --location https://apt.releases.hashicorp.com/gpg | sudo apt-key add - \
&& apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release --codename --short) main" \
&& apt update \
&& apt-get install --yes terraform \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

# INSTALL PYTHON
ARG PYTHON_VERSION=3
RUN add-apt-repository universe --yes \
&& apt-get update \
&& PYTHON_SUFFIX="$(sed --expression='s/3.*/3/g' --expression='s/2.*//g' <<< "${PYTHON_VERSION}")" \
&& apt-get install --yes --no-install-recommends python${PYTHON_VERSION} python${PYTHON_SUFFIX}{-pip,-setuptools} \
&& update-alternatives --install /usr/bin/python python${PYTHON_VERSION} $(which python${PYTHON_VERSION}) 10 \
&& python -m pip install pip --upgrade \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

# INSTALL DVC
ARG DVC_VERSION=2
RUN cd /etc/apt/sources.list.d \
&& wget https://dvc.org/deb/dvc.list \
&& apt-get update \
&& apt-get install --yes "dvc=${DVC_VERSION}.*" \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/*

# INSTALL CML
ARG CML_VERSION=0
RUN npm config set user 0 \
&& npm install --global "git+https://github.com/iterative/cml"

# INSTALL VEGA
RUN add-apt-repository universe --yes \
&& apt-get update \
&& apt-get install --yes \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
libfontconfig-dev \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/* \
&& npm config set user 0 \
&& npm install --global canvas vega vega-cli vega-lite

# CONFIGURE RUNNER PATH
ENV RUNNER_PATH=/home/runner
ENV RUNNER_ALLOW_RUNASROOT=1
RUN mkdir ${RUNNER_PATH}
WORKDIR ${RUNNER_PATH}

# COMMAND
ENV IN_DOCKER=1
CMD ["cml-runner"]
Loading