made a better image, now node and flutter are included.
Some checks failed
/ build-web (push) Failing after 28s

This commit is contained in:
zeyus 2025-07-21 21:45:01 +02:00
parent d8e5b806a8
commit 61744f8e25
Signed by: zeyus
GPG key ID: A836639BA719C614
2 changed files with 54 additions and 22 deletions

35
.docker/Dockerfile Normal file
View file

@ -0,0 +1,35 @@
FROM ubuntu:22.04
# Set environment variables
ENV FLUTTER_HOME=/opt/flutter
ENV PATH="$FLUTTER_HOME/bin:$PATH"
ENV PUB_CACHE=/opt/pub-cache
# Install system dependencies including Node.js
# Nodejs is required for the forgejo runner (checkout action)
RUN apt-get update && apt-get install -y \
curl \
git \
wget \
unzip \
ca-certificates \
gnupg \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Flutter
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_HOME \
&& flutter doctor \
&& flutter channel stable \
&& flutter upgrade \
&& flutter config --enable-web \
&& flutter precache --web
# Create cache directories
RUN mkdir -p $PUB_CACHE
WORKDIR /workspace

View file

@ -5,37 +5,34 @@ on:
jobs: jobs:
build-web: build-web:
# custom runner image -> includes node and latest flutter stable
runs-on: flutter-web-builder runs-on: flutter-web-builder
steps: steps:
- name: install node
id: node-install
run: |
apt update
apt install -y ca-certificates curl gnupg
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
apt update
apt install -y nodejs
flutter channel stable
flutter upgrade
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Cache Flutter # Cache pub dependencies (this should work now)
id: cache-flutter
uses: actions/cache@v4
with:
path: ${{ forge.workspace }}/../.tool-cache
key: ${{ forge.ref_name }}-flutter-cache-temp
- name: Cache pub dependencies - name: Cache pub dependencies
uses: actions/cache@v4 uses: actions/cache@v4
id: cache-pub id: cache-pub
with: with:
path: ${{ forge.workspace }}/../.pub-cache path: /opt/pub-cache
key: ${{ forge.ref_name }}-pub-cache-temp key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
# Cache build outputs and tool cache
- name: Cache Flutter build
uses: actions/cache@v4
with:
path: |
.dart_tool
build
key: ${{ runner.os }}-flutter-build-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('lib/**/*.dart') }}
restore-keys: |
${{ runner.os }}-flutter-build-${{ hashFiles('**/pubspec.lock') }}-
${{ runner.os }}-flutter-build-
- name: Get dependencies - name: Get dependencies
run: flutter pub get run: flutter pub get