-
Notifications
You must be signed in to change notification settings - Fork 1.8k
docker build images #4356
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
docker build images #4356
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Builder image for Flameshot (Ubuntu 24.04) | ||
| # Purpose: provide a reproducible build environment with CMake >= 3.29 and Qt6 dev packages. | ||
| # Usage: build this image, then mount the repo and run cmake/cmake --build inside a container or use this image in CI. | ||
|
|
||
| FROM ubuntu:24.04 | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install basic tools and add Kitware APT repo for modern CMake | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends software-properties-common ca-certificates gnupg curl wget lsb-release apt-transport-https \ | ||
| && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg \ | ||
| && echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/kitware.list \ | ||
| && apt-get update | ||
|
|
||
| # Install build deps (CMake from Kitware, compilers, Qt dev packages, tools) | ||
| RUN apt-get install -y --no-install-recommends \ | ||
| cmake \ | ||
| build-essential \ | ||
| git \ | ||
| pkg-config \ | ||
| ninja-build \ | ||
| ca-certificates \ | ||
| qt6-base-dev \ | ||
| qt6-tools-dev \ | ||
| qt6-svg-dev \ | ||
| qt6-tools-dev-tools \ | ||
| qtmultimedia5-dev \ | ||
| libxcb-xinerama0-dev \ | ||
| libxcb1-dev \ | ||
| libxcb-util-dev \ | ||
| libxcb-render-util0-dev \ | ||
| libxcb-render0-dev \ | ||
| libx11-dev \ | ||
| python3 \ | ||
| python3-pip \ | ||
| sudo \ | ||
| curl \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Create a non-root user for builds | ||
| ARG BUILD_USER=builder | ||
| RUN useradd -m -s /bin/bash ${BUILD_USER} && \ | ||
| echo "${BUILD_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${BUILD_USER} | ||
|
|
||
| WORKDIR /work | ||
|
|
||
| # Default entrypoint is bash so CI/scripts can run cmake inside the container | ||
| CMD ["bash"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # NixOS note | ||
|
|
||
| NixOS has an uncommon runtime layout and uses immutable package store paths. Building Flameshot for NixOS is best done using `nix-shell` or `nix build` as described in the main `README.md` under the NixOS section. | ||
|
|
||
| This repository provides linux distro builder images for more traditional distributions (Ubuntu, Fedora, Arch). NixOS users should prefer the native `nix-shell` workflow instead of these Docker builders. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Available builder targets | ||
|
|
||
| This folder contains per-OS builder images that aim to reproduce the native development environment for the target OS/distro. Use the matching builder to produce a binary that behaves like a native build on that OS. | ||
|
|
||
| Available targets: | ||
|
|
||
| - `ubuntu24` — Ubuntu 24.04 based builder | ||
| - `fedora` — Fedora 40 based builder | ||
| - `arch` — Arch Linux based builder | ||
|
|
||
| Notes: | ||
| - These builders produce Linux ELF binaries. They are intended to match the target distro's toolchain and runtime packages. They do not produce macOS or Windows binaries. | ||
| - NixOS users should use `nix-shell` or refer to `NIXOS.md` for guidance. | ||
|
|
||
| Usage example (Fedora): | ||
|
|
||
| ```bash | ||
| cd packaging/docker/docker-build/fedora | ||
| ./build.sh | ||
| # artifacts will be placed in the repo's build/ directory | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Builder image for Flameshot (Arch Linux) | ||
| FROM archlinux:latest | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN pacman -Syu --noconfirm \ | ||
| && pacman -S --noconfirm base-devel cmake git qt6-base qt6-tools qt6-svg ninja python sudo \ | ||
| && pacman -Scc --noconfirm | ||
|
|
||
| RUN useradd -m -s /bin/bash builder && \ | ||
| echo "builder ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/builder | ||
|
|
||
| WORKDIR /work | ||
|
|
||
| CMD ["bash"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| IMAGE_NAME=flameshot-builder-arch:local | ||
| HERE=$(cd "$(dirname "$0")" && pwd) | ||
| # script is located at packaging/docker/docker-build/arch | ||
| # go up 4 levels to reach repo root | ||
| REPO_ROOT=$(cd "$HERE/../../../.." && pwd) | ||
|
|
||
| echo "Building builder image: $IMAGE_NAME" | ||
| docker build -t "$IMAGE_NAME" -f "$HERE/Dockerfile" "$HERE" | ||
|
|
||
| echo "Running build inside container (output will be written to $REPO_ROOT/build)" | ||
| mkdir -p "$REPO_ROOT/build" | ||
| # capture host uid/gid to restore ownership after the container run | ||
| HOST_UID=$(id -u) | ||
| HOST_GID=$(id -g) | ||
|
|
||
| # Run cmake inside container with repo mounted at /src | ||
| docker run --rm -it --user "$HOST_UID:$HOST_GID" -v "$REPO_ROOT":/src -w /src "$IMAGE_NAME" \ | ||
| bash -lc "rm -rf build && cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)" | ||
|
|
||
| echo "Build finished. Artifacts in $REPO_ROOT/build (created as UID:GID $HOST_UID:$HOST_GID)" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| # Convenience script: build the builder image and run a build inside it, producing host-mounted artifacts. | ||||||
| set -euo pipefail | ||||||
|
|
||||||
| HERE=$(cd "$(dirname "$0")" && pwd) | ||||||
| REPO_ROOT=$(cd "$HERE/../../.." && pwd) | ||||||
| IMAGE_NAME=flameshot-builder:local | ||||||
|
|
||||||
| echo "Building builder image: $IMAGE_NAME" | ||||||
| docker build -t "$IMAGE_NAME" "$HERE" | ||||||
|
|
||||||
| echo "Running build inside container (output will be written to $REPO_ROOT/build)" | ||||||
| # Run cmake inside container with repo mounted at /src | ||||||
| docker run --rm -it -v "$REPO_ROOT":/src -w /src "$IMAGE_NAME" \ | ||||||
| bash -lc "rm -rf build && cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)" | ||||||
|
|
||||||
| echo "Build finished. Artifacts in $REPO_ROOT/build" | ||||||
|
||||||
| echo "Build finished. Artifacts in $REPO_ROOT/build" | |
| echo "Build finished. Artifacts in $REPO_ROOT/build" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Optional: CI args for docker builds | ||
| # Set these in CI if you need to override tags or builder image names | ||
| export IMAGE_BUILDER_NAME=ghcr.io/your-org/flameshot-builder | ||
| export IMAGE_RUNTIME_NAME=ghcr.io/your-org/flameshot | ||
|
|
||
| # Example: use a commit-specific tag | ||
| # export IMAGE_TAG="commit-${GITHUB_SHA::8}" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||
| Builder image for Flameshot | ||||||
|
||||||
| Builder image for Flameshot | |
| # Builder image for Flameshot |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Section headers should be formatted as markdown headings (e.g., ## Purpose) for proper document structure and navigation.
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Section headers should be formatted as markdown headings (e.g., ## Key details) for proper document structure and navigation.
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Section headers should be formatted as markdown headings (e.g., ## Usage (local)) for proper document structure and navigation.
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Section headers should be formatted as markdown headings (e.g., ## Notes for CI) for proper document structure and navigation.
| Notes for CI | |
| ## Notes for CI |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||
| # Builder image for Flameshot (Fedora) | ||||
| FROM registry.fedoraproject.org/fedora:40 | ||||
|
|
||||
| ARG DEBIAN_FRONTEND=noninteractive | ||||
|
||||
| ARG DEBIAN_FRONTEND=noninteractive |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Build helper for Fedora builder image | ||
| IMAGE_NAME=flameshot-builder-fedora:local | ||
| HERE=$(cd "$(dirname "$0")" && pwd) | ||
| # script is located at packaging/docker/docker-build/fedora | ||
| # go up 4 levels to reach repo root | ||
| REPO_ROOT=$(cd "$HERE/../../../.." && pwd) | ||
|
|
||
| echo "Building builder image: $IMAGE_NAME" | ||
| docker build -t "$IMAGE_NAME" -f "$HERE/Dockerfile" "$HERE" | ||
|
|
||
| echo "Running build inside container (output will be written to $REPO_ROOT/build)" | ||
| mkdir -p "$REPO_ROOT/build" | ||
| # capture host uid/gid to restore ownership after the container run | ||
| HOST_UID=$(id -u) | ||
| HOST_GID=$(id -g) | ||
|
|
||
| # Run cmake inside container with repo mounted at /src | ||
| docker run --rm -it --user "$HOST_UID:$HOST_GID" -v "$REPO_ROOT":/src -w /src "$IMAGE_NAME" \ | ||
| bash -lc "rm -rf build && cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)" | ||
|
|
||
| echo "Build finished. Artifacts in $REPO_ROOT/build (created as UID:GID $HOST_UID:$HOST_GID)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| FROM opensuse/tumbleweed:latest | ||
|
|
||
| RUN zypper --non-interactive refresh && \ | ||
| zypper --non-interactive install -t pattern devel_C_C++ && \ | ||
| zypper --non-interactive install cmake gcc-c++ make git pkg-config && \ | ||
| zypper --non-interactive install \ | ||
| libQt6-qtbase-devel libQt6-qtsvg-devel libQt6-qttools-devel libQt6-linguist-devel || true && \ | ||
| zypper clean -a | ||
|
|
||
| WORKDIR /work | ||
|
|
||
| CMD ["/bin/bash"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| IMAGE_NAME=flameshot-builder-opensuse-tumbleweed:local | ||
| HERE=$(cd "$(dirname "$0")" && pwd) | ||
| REPO_ROOT=$(cd "$HERE/../../../.." && pwd) | ||
|
|
||
| echo "Building builder image: $IMAGE_NAME" | ||
| docker build -t "$IMAGE_NAME" -f "$HERE/Dockerfile" "$HERE" | ||
|
|
||
| echo "Running build inside container (output will be written to $REPO_ROOT/build)" | ||
| mkdir -p "$REPO_ROOT/build" | ||
| HOST_UID=$(id -u) | ||
| HOST_GID=$(id -g) | ||
|
|
||
| docker run --rm -it --user "$HOST_UID:$HOST_GID" -v "$REPO_ROOT":/src -w /src "$IMAGE_NAME" \ | ||
| bash -lc "rm -rf build && cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)" | ||
|
|
||
| echo "Build finished. Artifacts in $REPO_ROOT/build (created as UID:GID $HOST_UID:$HOST_GID)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| FROM rockylinux:9 | ||
|
|
||
| ENV DNF_YES=1 | ||
|
|
||
| RUN dnf -y update && \ | ||
| dnf -y install \ | ||
| epel-release \ | ||
| dnf-plugins-core && \ | ||
| dnf -y install \ | ||
| make cmake gcc-c++ git which pkgconfig \ | ||
| qt6-qtbase-devel qt6-qtsvg-devel qt6-qttools-devel \ | ||
| || true && dnf clean all | ||
|
|
||
| WORKDIR /work | ||
|
|
||
| CMD ["/bin/bash"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| IMAGE_NAME=flameshot-builder-rocky:local | ||
| HERE=$(cd "$(dirname "$0")" && pwd) | ||
| REPO_ROOT=$(cd "$HERE/../../../.." && pwd) | ||
|
|
||
| echo "Building builder image: $IMAGE_NAME" | ||
| docker build -t "$IMAGE_NAME" -f "$HERE/Dockerfile" "$HERE" | ||
|
|
||
| echo "Running build inside container (output will be written to $REPO_ROOT/build)" | ||
| mkdir -p "$REPO_ROOT/build" | ||
| HOST_UID=$(id -u) | ||
| HOST_GID=$(id -g) | ||
|
|
||
| docker run --rm -it --user "$HOST_UID:$HOST_GID" -v "$REPO_ROOT":/src -w /src "$IMAGE_NAME" \ | ||
| bash -lc "rm -rf build && cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)" | ||
|
|
||
| echo "Build finished. Artifacts in $REPO_ROOT/build (created as UID:GID $HOST_UID:$HOST_GID)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Builder image for Flameshot (Ubuntu 24.04) | ||
| FROM ubuntu:24.04 | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install basic tools and add Kitware APT repo for modern CMake | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends software-properties-common ca-certificates gnupg curl wget lsb-release apt-transport-https \ | ||
| && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg \ | ||
| && echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/kitware.list \ | ||
| && apt-get update | ||
|
|
||
| # Install build deps (CMake from Kitware, compilers, Qt dev packages, tools) | ||
| RUN apt-get install -y --no-install-recommends \ | ||
| cmake \ | ||
| build-essential \ | ||
| git \ | ||
| pkg-config \ | ||
| ninja-build \ | ||
| ca-certificates \ | ||
| qt6-base-dev \ | ||
| qt6-tools-dev \ | ||
| qt6-svg-dev \ | ||
| qt6-tools-dev-tools \ | ||
| qtmultimedia5-dev \ | ||
| libxcb-xinerama0-dev \ | ||
| libxcb1-dev \ | ||
| libxcb-util-dev \ | ||
| libxcb-render-util0-dev \ | ||
| libxcb-render0-dev \ | ||
| libx11-dev \ | ||
| python3 \ | ||
| python3-pip \ | ||
| sudo \ | ||
| curl \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Create a non-root user for builds | ||
| ARG BUILD_USER=builder | ||
| RUN useradd -m -s /bin/bash ${BUILD_USER} && \ | ||
| echo "${BUILD_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${BUILD_USER} | ||
|
|
||
| WORKDIR /work | ||
|
|
||
| # Default entrypoint is bash so CI/scripts can run cmake inside the container | ||
| CMD ["bash"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| IMAGE_NAME=flameshot-builder-ubuntu24:local | ||
| HERE=$(cd "$(dirname "$0")" && pwd) | ||
| # script is located at packaging/docker/docker-build/ubuntu24 | ||
| REPO_ROOT=$(cd "$HERE/../../../.." && pwd) | ||
|
|
||
| echo "Building builder image: $IMAGE_NAME" | ||
| docker build -t "$IMAGE_NAME" -f "$HERE/Dockerfile" "$HERE" | ||
|
|
||
| echo "Running build inside container (output will be written to $REPO_ROOT/build)" | ||
| mkdir -p "$REPO_ROOT/build" | ||
| # capture host uid/gid to restore ownership after the container run | ||
| HOST_UID=$(id -u) | ||
| HOST_GID=$(id -g) | ||
|
|
||
| docker run --rm -it --user "$HOST_UID:$HOST_GID" -v "$REPO_ROOT":/src -w /src "$IMAGE_NAME" \ | ||
| bash -lc "rm -rf build && cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j\$(nproc)" | ||
|
|
||
| echo "Build finished. Artifacts in $REPO_ROOT/build (created as UID:GID $HOST_UID:$HOST_GID)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEBIAN_FRONTEND is a Debian/Ubuntu-specific environment variable that has no effect on Arch Linux which uses pacman. This ARG declaration should be removed.