made a better image, now node and flutter are included.
Some checks failed
/ build-web (push) Failing after 28s
Some checks failed
/ build-web (push) Failing after 28s
This commit is contained in:
parent
d8e5b806a8
commit
61744f8e25
2 changed files with 54 additions and 22 deletions
35
.docker/Dockerfile
Normal file
35
.docker/Dockerfile
Normal 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
|
|
@ -5,37 +5,34 @@ on:
|
|||
|
||||
jobs:
|
||||
build-web:
|
||||
# custom runner image -> includes node and latest flutter stable
|
||||
runs-on: flutter-web-builder
|
||||
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
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache Flutter
|
||||
id: cache-flutter
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ forge.workspace }}/../.tool-cache
|
||||
key: ${{ forge.ref_name }}-flutter-cache-temp
|
||||
|
||||
# Cache pub dependencies (this should work now)
|
||||
- name: Cache pub dependencies
|
||||
uses: actions/cache@v4
|
||||
id: cache-pub
|
||||
with:
|
||||
path: ${{ forge.workspace }}/../.pub-cache
|
||||
key: ${{ forge.ref_name }}-pub-cache-temp
|
||||
path: /opt/pub-cache
|
||||
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
|
||||
run: flutter pub get
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue