Skip to content

Commit

Permalink
parameterize ubuntu release in dockerfile and GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Isla committed Nov 24, 2021
1 parent b3ea290 commit 37f1e8f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_publish_all_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
github_username: ${{ github.actor }}
image_source_directory: .
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}-ubuntu18.04
build_args: PACKAGE_VERSION=0.0.0.dev0;BASE_IMAGE=ubuntu:18.04;GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:${{ needs.release_version.outputs.tag }}-ubuntu18.04;PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=0.0.0.dev0;UBUNTU_RELEASE=18.04;GSTREAMER_BASE_IMAGE_RELEASE=${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}

###
# Example image, Ubuntu 20.04
Expand All @@ -178,4 +178,4 @@ jobs:
github_username: ${{ github.actor }}
image_source_directory: .
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=0.0.0.dev0;GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:${{ needs.release_version.outputs.tag }}-ubuntu20.04;PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=0.0.0.dev0;UBUNTU_RELEASE=20.04;GSTREAMER_BASE_IMAGE_RELEASE=${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
4 changes: 2 additions & 2 deletions .github/workflows/build_and_publish_changed_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ jobs:
github_username: ${{ github.actor }}
image_source_directory: .
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}-ubuntu18.04
build_args: PACKAGE_VERSION=0.0.0.dev0;BASE_IMAGE=ubuntu:18.04;GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:${{ needs.release_version.outputs.tag }}-ubuntu18.04;PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=0.0.0.dev0;UBUNTU_RELEASE=18.04;GSTREAMER_BASE_IMAGE_RELEASE=${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}

###
# Test image, Ubuntu 20.04
Expand All @@ -308,4 +308,4 @@ jobs:
github_username: ${{ github.actor }}
image_source_directory: .
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=0.0.0.dev0;GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:${{ needs.release_version.outputs.tag }}-ubuntu20.04;PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=0.0.0.dev0;UBUNTU_RELEASE=20.04;GSTREAMER_BASE_IMAGE_RELEASE=${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
34 changes: 17 additions & 17 deletions .github/workflows/publish_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ jobs:
image_tag_2: ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}

###
# Example image, latest, Ubuntu 20.04
# Example image, Ubuntu 18.04
###
build_gst-py-example:
build_gst-py-example_ubuntu1804:
needs:
- release_version
- build_addons_gst-web
- build_addons_gstreamer_ubuntu2004
- build_addons_gstreamer_ubuntu1804
- build_py_build
runs-on: ubuntu-latest
steps:
Expand All @@ -327,18 +327,18 @@ jobs:
github_personal_access_token: ${{ secrets.GITHUB_TOKEN }}
github_username: ${{ github.actor }}
image_source_directory: .
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:latest
image_tag_2: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}
build_args: PACKAGE_VERSION=${{ needs.build_py_build.outputs.package_version }};GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:latest-ubuntu18.04
image_tag_2: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}-ubuntu18.04
build_args: PACKAGE_VERSION=${{ needs.build_py_build.outputs.package_version }};UBUNTU_RELEASE=18.04;GSTREAMER_BASE_IMAGE_RELEASE=${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}

###
# Example image, latest, Ubuntu 18.04
# Example image, Ubuntu 20.04
###
build_gst-py-example_ubuntu1804:
build_gst-py-example:
needs:
- release_version
- build_addons_gst-web
- build_addons_gstreamer_ubuntu1804
- build_addons_gstreamer_ubuntu2004
- build_py_build
runs-on: ubuntu-latest
steps:
Expand All @@ -350,9 +350,9 @@ jobs:
github_personal_access_token: ${{ secrets.GITHUB_TOKEN }}
github_username: ${{ github.actor }}
image_source_directory: .
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:latest-ubuntu18.04
image_tag_2: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}-ubuntu18.04
build_args: PACKAGE_VERSION=${{ needs.build_py_build.outputs.package_version }};BASE_IMAGE=ubuntu:18.04;GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:${{ needs.release_version.outputs.tag }}-ubuntu1804;PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}
image_tag_1: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:latest-ubuntu20.04
image_tag_2: ghcr.io/selkies-project/selkies-gstreamer/gst-py-example:${{ needs.release_version.outputs.tag }}-ubuntu20.04
build_args: PACKAGE_VERSION=${{ needs.build_py_build.outputs.package_version }};UBUNTU_RELEASE=20.04;GSTREAMER_BASE_IMAGE_RELEASE=${{ needs.release_version.outputs.tag }};PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:${{ needs.release_version.outputs.tag }};WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:${{ needs.release_version.outputs.tag }}

###
# Publish gst-web artifacts to GCS
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:
create_release:
runs-on: ubuntu-latest
needs:
- publish_gstreamer_gcs
- publish_gstreamer_gcs_ubuntu2004
- publish_gstreamer_gcs_ubuntu1804
- publish_gst_py_gcs
- publish_gst_web_gcs
Expand All @@ -422,7 +422,7 @@ jobs:
id: gstreamer_cache_asset
uses: actions/cache@v2
with:
path: ${{ needs.publish_gstreamer_gcs.outputs.asset_path }}
path: ${{ needs.publish_gstreamer_gcs_ubuntu2004.outputs.asset_path }}
key: gstreamer-asset
- name: Cache Asset, gstreamer-ubuntu1804
id: gstreamer_cache_asset_ubuntu1804
Expand Down Expand Up @@ -460,9 +460,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ needs.publish_gstreamer_gcs.outputs.asset_path }}
asset_name: ${{ needs.publish_gstreamer_gcs.outputs.asset_name }}
asset_content_type: ${{ needs.publish_gstreamer_gcs.outputs.asset_mimetype }}
asset_path: ${{ needs.publish_gstreamer_gcs_ubuntu2004.outputs.asset_path }}
asset_name: ${{ needs.publish_gstreamer_gcs_ubuntu2004.outputs.asset_name }}
asset_content_type: ${{ needs.publish_gstreamer_gcs_ubuntu2004.outputs.asset_mimetype }}

- name: Upload GStreamer Ubuntu 18.04 Asset to Release
uses: actions/upload-release-asset@v1
Expand Down
12 changes: 5 additions & 7 deletions Dockerfile.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Supported base images: ubuntu:20.04, ubuntu:18.04
ARG BASE_IMAGE=ubuntu:20.04

# Use the master-ubuntu18.04 tag or latest-ubuntu18.04 tag if base image is ubuntu:18.04
ARG GSTREAMER_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer:latest

ARG UBUNTU_RELEASE=20.04
ARG GSTREAMER_BASE_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gstreamer
ARG GSTREAMER_BASE_IMAGE_RELEASE=latest
ARG PY_BUILD_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/py-build:latest
ARG WEB_IMAGE=ghcr.io/selkies-project/selkies-gstreamer/gst-web:latest
FROM ${GSTREAMER_IMAGE} as selkies-gstreamer
FROM ${GSTREAMER_BASE_IMAGE}:${GSTREAMER_BASE_IMAGE_RELEASE}-ubuntu${UBUNTU_RELEASE} as selkies-gstreamer
FROM ${PY_BUILD_IMAGE} as selkies-build
FROM ${WEB_IMAGE} as selkies-web
FROM ${BASE_IMAGE}
FROM ubuntu:${UBUNTU_RELEASE}

LABEL maintainer "https://github.com/danisla"

Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ services:
context: ./addons/gst-web
dockerfile: Dockerfile
test:
image: selkies-gstreamer-example
image: selkies-gstreamer-example:latest-ubuntu20.04
entrypoint: ["/tini", "--", "/bin/bash"]
build:
context: .
dockerfile: Dockerfile.example
args:
GSTREAMER_IMAGE: ghcr.io/selkies-project/selkies-gstreamer/gstreamer:latest
UBUNTU_RELEASE: 20.04
GSTREAMER_BASE_IMAGE: ghcr.io/selkies-project/selkies-gstreamer/gstreamer
GSTREAMER_BASE_IMAGE_RELEASE: latest
PY_BUILD_IMAGE: selkies-gstreamer-py-build:latest
WEB_IMAGE: gst-web:latest
PYPI_PACKAGE: selkies_gstreamer
Expand Down

0 comments on commit 37f1e8f

Please sign in to comment.