compilazione linux su docker x retrocompatibilità

This commit is contained in:
brontomark committed 2026-11-21 15:10:24 +01:00
1 parent 57a4dc6f68
commit 7572f4c061
3 files changed
+106 -41

No files matched your search

+10 -41
View File
@@ -124,10 +124,10 @@ jobs:
-d "{\"latest_version\": \"$TagVersion\"}" -d "{\"latest_version\": \"$TagVersion\"}"
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# JOB 4: LINUX APPIMAGE (Gira sul tuo PC Fedora / Linux Runner) # JOB 4: LINUX APPIMAGE (Build isolata su Ubuntu 22.04 via Docker)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
build-linux: build-linux:
runs-on: linux-runner # <--- Etichetta del tuo runner Linux / Fedora in ufficio runs-on: linux-runner # <--- Etichetta del tuo runner Linux in ufficio
steps: steps:
- name: Checkout del codice - name: Checkout del codice
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -138,48 +138,17 @@ jobs:
${{ secrets.ENV_FILE_CONTENT }} ${{ secrets.ENV_FILE_CONTENT }}
EOF EOF
- name: Pulizia Cache e Fetch Dipendenze - name: Prepara immagine Docker (Ubuntu 22.04 / x86-64-baseline)
run: | run: |
rm -rf .dart_tool docker build -t flux-linux-builder -f docker/linux-appimage.Dockerfile docker
flutter pub get
- name: Build Flutter Linux - name: Build Flutter Linux e Genera AppImage nel container
run: flutter build linux --release
- name: Prepara AppDir per AppImage
run: | run: |
mkdir -p build/Flux.AppDir docker run --rm \
cp -r build/linux/x64/release/bundle/* build/Flux.AppDir/ -e HOST_UID="$(id -u)" \
cp assets/icon/icon.png build/Flux.AppDir/flux.png -e HOST_GID="$(id -g)" \
-v "$PWD:/workspace" \
cat << 'EOF' > build/Flux.AppDir/AppRun flux-linux-builder
#!/bin/sh
cd "$(dirname "$0")"
exec ./flux "$@"
EOF
chmod +x build/Flux.AppDir/AppRun
cat << 'EOF' > build/Flux.AppDir/Flux.desktop
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Flux
Exec=flux %u
Icon=flux
Categories=Utility;
EOF
- name: Scarica appimagetool se non presente
run: |
if [ ! -f ./appimagetool-x86_64.AppImage ]; then
curl -L -o appimagetool-x86_64.AppImage https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
fi
- name: Genera AppImage
run: |
ARCH=x86_64 ./appimagetool-x86_64.AppImage build/Flux.AppDir Flux-x86_64.AppImage
- name: Upload Linux AppImage Asset - name: Upload Linux AppImage Asset
uses: https://gitea.com/actions/release-action@main uses: https://gitea.com/actions/release-action@main
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
SRC_DIR="/tmp/flux-src"
APPDIR="/tmp/Flux.AppDir"
OUT_APPIMAGE="/workspace/Flux-x86_64.AppImage"
rm -rf "${SRC_DIR}" "${APPDIR}"
mkdir -p "${SRC_DIR}"
tar -C /workspace \
--exclude='./.git' \
--exclude='./build' \
--exclude='./.dart_tool' \
--exclude='./*.AppImage' \
--exclude='./*.AppDir' \
--exclude='./appimagetool*' \
-cf - . | tar -C "${SRC_DIR}" -xf -
cd "${SRC_DIR}"
flutter pub get
flutter build linux --release
mkdir -p "${APPDIR}"
cp -r build/linux/x64/release/bundle/* "${APPDIR}/"
cp assets/icon/icon.png "${APPDIR}/flux.png"
cat << 'EOF' > "${APPDIR}/AppRun"
#!/bin/sh
cd "$(dirname "$0")"
exec ./flux "$@"
EOF
chmod +x "${APPDIR}/AppRun"
cat << 'EOF' > "${APPDIR}/Flux.desktop"
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Flux
Exec=flux %u
Icon=flux
Categories=Utility;
EOF
ARCH=x86_64 appimagetool "${APPDIR}" "${OUT_APPIMAGE}"
if [ -n "${HOST_UID:-}" ] && [ -n "${HOST_GID:-}" ]; then
chown "${HOST_UID}:${HOST_GID}" "${OUT_APPIMAGE}"
fi
+45
View File
@@ -0,0 +1,45 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
ca-certificates \
clang \
cmake \
curl \
file \
git \
libgtk-3-dev \
liblzma-dev \
libstdc++-12-dev \
ninja-build \
pkg-config \
unzip \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
ARG FLUTTER_CHANNEL=stable
RUN git config --global --add safe.directory '*' \
&& git clone https://github.com/flutter/flutter.git -b "${FLUTTER_CHANNEL}" --depth 1 /opt/flutter
ENV PATH="/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:${PATH}"
RUN flutter config --no-analytics --enable-linux-desktop \
&& flutter precache --linux
RUN curl -fsSL -o /tmp/appimagetool.AppImage \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage \
&& chmod +x /tmp/appimagetool.AppImage \
&& cd /opt \
&& /tmp/appimagetool.AppImage --appimage-extract \
&& mv /opt/squashfs-root /opt/appimagetool \
&& ln -s /opt/appimagetool/AppRun /usr/local/bin/appimagetool \
&& rm -f /tmp/appimagetool.AppImage
COPY build-linux-appimage.sh /usr/local/bin/build-linux-appimage.sh
RUN chmod +x /usr/local/bin/build-linux-appimage.sh
WORKDIR /workspace
ENTRYPOINT ["/usr/local/bin/build-linux-appimage.sh"]