Compare commits

...

9 Commits

Author SHA1 Message Date
Brenden Matthews a03f0bc562 Fix typo 2024-05-02 15:14:48 -04:00
Brenden Matthews 89e8fe580e Move docker build to separate script for less jank 2024-05-02 15:09:45 -04:00
Brenden Matthews 2578be2447 Try to fix this quote handling again
Unsure why this works but it does 🤷‍♂️
2024-05-02 14:43:59 -04:00
Brenden Matthews a5cc142bba Fix this env var handling (derp) 2024-05-02 14:17:26 -04:00
Brenden Matthews 6a248a94d2 Docker: improve tagging, distinguish `main` and `latest`
* Use `latest` for the latest release
 * Use `main` (or the branch) for the latest dev builds against a branch
 * Tag releases with their version
 * Only push when building against `main` branch
 * Only build amd64 images on PRs for speedier builds
 * Separate main/PR caches
2024-05-02 14:00:15 -04:00
Brenden Matthews 9dfc7318f9 Bump minor version 2024-05-02 13:23:43 -04:00
Brenden Matthews 8ba6cf625c Docker: use 64bit time packages 2024-05-02 13:21:55 -04:00
Brenden Matthews 35d72314d2 Docker: re-enable PR builds 2024-05-02 13:21:55 -04:00
Brenden Matthews a533bcb8e4 Docker: updated base image to Ubuntu 24.04 LTS
This allows us to drop the CMake compliation step, which should speed up
image build times significantly.
2024-05-02 13:21:55 -04:00
4 changed files with 69 additions and 48 deletions

45
.github/scripts/docker-build.bash vendored Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -ex
DOCKERHUB_IMAGE_ID=$DOCKERHUB_ACCOUNT/$IMAGE_NAME
# Change all uppercase to lowercase
DOCKERHUB_IMAGE_ID=$(echo $DOCKERHUB_IMAGE_ID | tr '[A-Z]' '[a-z]')
image_tags=()
# Strip git ref prefix from version
VERSION_TAG=$(echo $GITHUB_REF | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION_TAG=$(echo $VERSION_TAG | sed -e 's/^v//')
fi
image_tags+=("--tag" "$DOCKERHUB_IMAGE_ID:$VERSION_TAG")
# tag as latest on releases
if [[ "$RELEASE" == ON ]]; then
image_tags+=("--tag" "$DOCKERHUB_IMAGE_ID:latest")
fi
# Only build amd64 on PRs, build all platforms on main. The arm builds
# take far too long.
image_platforms="--platform linux/amd64"
push_image=""
cache_tag="pr-cache"
# Only push on main
if [[ "$GITHUB_REF" == refs/heads/main ]]; then
push_image="--push"
image_platforms="--platform linux/arm/v7,linux/arm64/v8,linux/amd64"
cache_tag="main-cache"
fi
docker buildx build \
${push_image} \
${image_platforms} \
--cache-from=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:$cache_tag \
--cache-to=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:$cache_tag,mode=max \
"${image_tags[@]}" \
.

View File

@ -2,7 +2,13 @@ name: Docker
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
paths-ignore:
- web/**
- doc/**
pull_request:
branches:
- main
paths-ignore:
@ -23,7 +29,7 @@ env:
DOCKER_BUILDKIT: 1
jobs:
buildx:
docker-buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -35,26 +41,8 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Log into Dockerhub registry
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u $DOCKERHUB_ACCOUNT --password-stdin
- name: Build
run: |
DOCKERHUB_IMAGE_ID=$DOCKERHUB_ACCOUNT/$IMAGE_NAME
# Change all uppercase to lowercase
DOCKERHUB_IMAGE_ID=$(echo $DOCKERHUB_IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
docker buildx build \
--push \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
--cache-from=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:buildcache \
--cache-to=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:buildcache,mode=max \
--tag $DOCKERHUB_IMAGE_ID:$VERSION \
.
- name: Build and push Docker image
env:
RELEASE: "${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}"
GITHUB_REF: ${{ github.ref }}
run: ./.github/scripts/docker-build.bash

View File

@ -1,4 +1,4 @@
FROM ubuntu:jammy AS builder
FROM ubuntu:noble AS builder
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
@ -6,6 +6,7 @@ RUN apt-get update \
audacious-dev \
ca-certificates \
clang \
cmake \
curl \
gfortran \
git \
@ -39,25 +40,11 @@ RUN apt-get update \
libxml2-dev \
libxmmsclient-dev \
libxnvctrl-dev \
make \
ninja-build \
patch \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Compile CMake, we need the latest because the bug here (for armv7 builds):
# https://gitlab.kitware.com/cmake/cmake/-/issues/20568
WORKDIR /cmake
ENV CMAKE_VERSION 3.25.1
RUN curl -Lq https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz -o cmake-${CMAKE_VERSION}.tar.gz \
&& tar xf cmake-${CMAKE_VERSION}.tar.gz \
&& cd cmake-${CMAKE_VERSION} \
&& CC=clang CXX=clang++ CFLAGS="-D_FILE_OFFSET_BITS=64" CXXFLAGS="-D_FILE_OFFSET_BITS=64" ./bootstrap --system-libs --parallel=5 \
&& make -j5 \
&& make -j5 install \
&& cd \
&& rm -rf /cmake
COPY . /conky
WORKDIR /conky/build
@ -112,7 +99,7 @@ RUN sh -c 'if [ "$X11" = "yes" ] ; then \
&& cmake --build . \
&& cmake --install .
FROM ubuntu:jammy
FROM ubuntu:noble
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
@ -121,14 +108,14 @@ RUN apt-get update \
libc++1 \
libc++abi1 \
libcairo2 \
libcurl4 \
libcurl4t64 \
libdbus-glib-1-2 \
libical3 \
libimlib2 \
libical3t64 \
libimlib2t64 \
libircclient1 \
libiw30 \
libiw30t64 \
liblua5.3-0 \
libmicrohttpd12 \
libmicrohttpd12t64 \
libmysqlclient21 \
libncurses6 \
libpulse0 \
@ -140,6 +127,7 @@ RUN apt-get update \
libxext6 \
libxfixes3 \
libxft2 \
libxi6 \
libxinerama1 \
libxml2 \
libxmmsclient6 \

View File

@ -132,8 +132,8 @@ endif(OS_HAIKU)
# Do version stuff
set(VERSION_MAJOR "1")
set(VERSION_MINOR "20")
set(VERSION_PATCH "3")
set(VERSION_MINOR "21")
set(VERSION_PATCH "0")
find_program(APP_AWK awk)