From 218a43be090538d8d446fb50eaf62ae63ab2bd8f Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Fri, 20 Jan 2023 10:47:20 -0800 Subject: [PATCH] Update the build process to tag multiple images + documentation for it --- Earthfile | 21 +++++++++++++++++--- build/develop/container.sh | 9 +++------ docs/Release.md | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 docs/Release.md diff --git a/Earthfile b/Earthfile index 60fcd6fd7..f89db1e57 100644 --- a/Earthfile +++ b/Earthfile @@ -102,8 +102,9 @@ package: SAVE ARTIFACT /build/dist/owncast.zip owncast.zip AS LOCAL dist/$ZIPNAME docker: - ARG image=ghcr.io/owncast/owncast - ARG tag=develop + # Multiple image names can be tagged at once. They should all be passed + # in as space separated strings using the full account/repo:tag format. + # https://github.com/earthly/earthly/blob/aea38448fa9c0064b1b70d61be717ae740689fb9/docs/earthfile/earthfile.md#assigning-multiple-image-names ARG TARGETPLATFORM FROM --platform=$TARGETPLATFORM alpine:3.15.5 RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates unzip && update-ca-certificates @@ -118,11 +119,25 @@ docker: ENTRYPOINT ["/app/owncast"] EXPOSE 8080 1935 - SAVE IMAGE --push $image:$tag + + ARG images=ghcr.io/owncast/owncast:testing + RUN echo "Saving images: ${images}" + + # Tag this image with the list of names + # passed along. + FOR --no-cache i IN ${images} + SAVE IMAGE --push "${i}" + END dockerfile: FROM DOCKERFILE -f Dockerfile . +testing: + ARG images + FOR i IN ${images} + RUN echo "Testing ${i}" + END + unit-tests: FROM --platform=linux/amd64 bdwyertech/go-crosscompile COPY . /build diff --git a/build/develop/container.sh b/build/develop/container.sh index a1bb0c7cc..872201924 100755 --- a/build/develop/container.sh +++ b/build/develop/container.sh @@ -4,24 +4,21 @@ set -e # Development container builder # # Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages -# env vars: +# env vars: # $EARTHLY_BUILD_BRANCH: git branch to checkout # $EARTHLY_BUILD_TAG: tag for container image - EARTHLY_IMAGE_NAME="owncast" BUILD_TAG=${EARTHLY_BUILD_TAG:-webv2} DATE=$(date +"%Y%m%d") VERSION="${DATE}-${BUILD_TAG}" - echo "Building container image ${EARTHLY_IMAGE_NAME}:${BUILD_TAG} ..." # Change to the root directory of the repository cd "$(git rev-parse --show-toplevel)" || exit if [ -n "${EARTHLY_BUILD_BRANCH}" ]; then - git checkout "${EARTHLY_BUILD_BRANCH}" || exit + git checkout "${EARTHLY_BUILD_BRANCH}" || exit fi -earthly --ci +docker-all --image="ghcr.io/owncast/${EARTHLY_IMAGE_NAME}" --tag="${BUILD_TAG}" --version="${VERSION}" -earthly --ci +dockerfile +earthly --ci +docker-all --images="ghcr.io/owncast/${EARTHLY_IMAGE_NAME}:${BUILD_TAG}" --version="${VERSION}" diff --git a/docs/Release.md b/docs/Release.md new file mode 100644 index 000000000..a9660a924 --- /dev/null +++ b/docs/Release.md @@ -0,0 +1,40 @@ +# Build + Distribute Official Owncast Releases + +Owncast is released both as standalone archives that can be downloaded and installed themselves, as well as Docker images that can be pulled from Docker Hub. + +The original Docker Hub image was [gabekangas/owncast](https://hub.docker.com/repository/docker/gabekangas/owncast) but it has been deprecated in favor of [owncast/owncast](https://hub.docker.com/repository/docker/owncast/owncast). In the short term both images will need to be updated with new releases and in the future we can deprecate the old one. + +## Dependencies + +1. Install [Earthly](https://earthly.dev/get-earthly), a build automation tool. It uses our [Earthfile](https://github.com/owncast/owncast/blob/develop/Earthfile) to reproducably build the release files and Docker images. +2. Be [logged into Docker Hub](https://docs.docker.com/engine/reference/commandline/login/) with an account that has access to `gabekangas/owncast` and `owncast/owncast` so the images can be pushed to Docker Hub. + +## Build release files + +1. Create the release archive files for all the different architectures. Specify the human readable version number in the `version` flag such as `v0.1.0`, `nightly`, `develop`, etc. It will be used to identify this binary when running Owncast. You'll find the archives for this release in the `dist` directory when it's complete. + + **Run**: `earthly +package-all --version="v0.1.0"` + +2. Create a release on GitHub with release notes and Changelog for the version. + +3. Upload the release archive files to the release on GitHub via the web interface. + +## Build and upload Docker images + +Specify the human readable version number in the `version` flag such as `v0.1.0`, `nightly`, `develop`, etc. It will be used to identify this binary when running Owncast. + +Create and push the image to Docker Hub with a list of tags. You'll want to tag the image with both the new version number and `latest`. + +**Run**: `earthly --push +docker-all --images="owncast/owncast:0.1.0 owncast/owncast:latest gabekangas/owncast:0.1.0 gabekangas/owncast:latest" --version="webv2"` + +Omit `--push` if you don't want to push the image to Docker Hub and want to just build and test the image locally first. + +## Update installer script + +Once you have uploaded the release archive files and made the new files public and are confident the release is working and available you can update the installer script to point to the new release. + +Edit the `OWNCAST_VERSION` in [`install.sh`](https://github.com/owncast/owncast.github.io/blob/master/static/install.sh). + +## Final + +Once the installer is pointing to the new release number and Docker Hub has new images tagged as `latest` the new version is released to the public.