Skip to content
Closed
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
50 changes: 50 additions & 0 deletions packaging/docker/docker-build/Dockerfile
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"]
5 changes: 5 additions & 0 deletions packaging/docker/docker-build/NIXOS.md
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.
21 changes: 21 additions & 0 deletions packaging/docker/docker-build/TARGETS.md
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
```
15 changes: 15 additions & 0 deletions packaging/docker/docker-build/arch/Dockerfile
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
Copy link

Copilot AI Nov 2, 2025

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.

Suggested change
ARG DEBIAN_FRONTEND=noninteractive

Copilot uses AI. Check for mistakes.

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"]
23 changes: 23 additions & 0 deletions packaging/docker/docker-build/arch/build.sh
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)"
17 changes: 17 additions & 0 deletions packaging/docker/docker-build/build.sh
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"
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected at end of line.

Suggested change
echo "Build finished. Artifacts in $REPO_ROOT/build"
echo "Build finished. Artifacts in $REPO_ROOT/build"

Copilot uses AI. Check for mistakes.
7 changes: 7 additions & 0 deletions packaging/docker/docker-build/ci-args.sh
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}"
29 changes: 29 additions & 0 deletions packaging/docker/docker-build/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Builder image for Flameshot
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document title should be formatted as a markdown heading (e.g., # Builder image for Flameshot) for proper document structure and rendering.

Suggested change
Builder image for Flameshot
# Builder image for Flameshot

Copilot uses AI. Check for mistakes.

Purpose
Copy link

Copilot AI Nov 2, 2025

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 uses AI. Check for mistakes.
- Provides a reproducible environment to build Flameshot from source.
- Targets Ubuntu 24.04 and installs CMake (from Kitware APT), gcc/g++, Qt6 development packages, and common build tools.

Key details
Copy link

Copilot AI Nov 2, 2025

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 uses AI. Check for mistakes.
- Base: ubuntu:24.04
- Installs: cmake, build-essential, git, qt6-base-dev, qt6-tools-dev, qt6-svg-dev, ninja-build, python3
- Creates user `builder` (uid 1000) for non-root builds

Usage (local)
Copy link

Copilot AI Nov 2, 2025

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 uses AI. Check for mistakes.
1. Build the image from `packaging/docker/docker-build`:

```bash
cd packaging/docker/docker-build
docker build -t flameshot-builder:local .
```

2. Run a container to build the project (bind-mount your repo root into /src):

```bash
REPO_ROOT=$(cd "$(dirname "$0")/../../.." && pwd)
docker run --rm -it -v "$REPO_ROOT":/src -w /src flameshot-builder:local \
bash -lc 'cmake -S . -B build -DQT_VERSION_MAJOR=6 -DCMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc)'
```

Notes for CI
Copy link

Copilot AI Nov 2, 2025

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.

Suggested change
Notes for CI
## Notes for CI

Copilot uses AI. Check for mistakes.
- In CI, build the builder image first, run the same build step inside the builder image, and then copy artifacts into the runtime image (multi-stage or by exporting files).
29 changes: 29 additions & 0 deletions packaging/docker/docker-build/fedora/Dockerfile
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
Copy link

Copilot AI Nov 2, 2025

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 Fedora which uses dnf. This ARG declaration should be removed.

Suggested change
ARG DEBIAN_FRONTEND=noninteractive

Copilot uses AI. Check for mistakes.

RUN dnf -y update && \
dnf -y install \
cmake \
gcc-c++ \
make \
git \
pkgconfig \
ninja-build \
qt6-qtbase-devel \
qt6-qtsvg-devel \
qt6-qttools-devel \
qt6-qttools-static \
kf6-kguiaddons-devel \
python3 \
sudo \
which && \
dnf clean all

RUN useradd -m -s /bin/bash builder && \
echo "builder ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/builder

WORKDIR /work

CMD ["bash"]
24 changes: 24 additions & 0 deletions packaging/docker/docker-build/fedora/build.sh
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)"
12 changes: 12 additions & 0 deletions packaging/docker/docker-build/opensuse-tumbleweed/Dockerfile
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"]
19 changes: 19 additions & 0 deletions packaging/docker/docker-build/opensuse-tumbleweed/build.sh
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)"
16 changes: 16 additions & 0 deletions packaging/docker/docker-build/rocky/Dockerfile
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"]
19 changes: 19 additions & 0 deletions packaging/docker/docker-build/rocky/build.sh
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)"
47 changes: 47 additions & 0 deletions packaging/docker/docker-build/ubuntu24/Dockerfile
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"]
21 changes: 21 additions & 0 deletions packaging/docker/docker-build/ubuntu24/build.sh
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)"
Loading