added workflow

This commit is contained in:
Mathias Beaulieu-Duncan 2025-06-12 12:35:41 -04:00
commit 3381c83206
Signed by: mathias
GPG Key ID: 1C16CF05BAF9162D
3 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,60 @@
name: Build Flutter Docker Image
on:
schedule:
- cron: '0 3 * * *' # Every day at 03:00 UTC
workflow_dispatch:
env:
IMAGE_NAME: singatias/flutter
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq curl
- name: Get latest Flutter version
id: flutter_version
run: |
FLUTTER_VERSION=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json | \
jq -r '. as $root | $root.current_release.stable as $stable_hash | $root.releases[] | select(.hash == $stable_hash) | .version')
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV
echo "Latest Flutter version: $FLUTTER_VERSION"
- name: Check if Docker image exists
id: check_image
run: |
IMAGE_TAG="${IMAGE_NAME}:${FLUTTER_VERSION}"
if docker manifest inspect $IMAGE_TAG > /dev/null 2>&1; then
echo "Image already exists for $FLUTTER_VERSION"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Image does not exist for $FLUTTER_VERSION"
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Log in to DockerHub
if: steps.check_image.outputs.exists == 'false'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Build, push, and generate SBOM and provenance
if: steps.check_image.outputs.exists == 'false'
run: |
docker buildx build \
--provenance=true \
--sbom=true \
--push \
-t ${{ IMAGE_NAME }}:${{ FLUTTER_VERSION }} \
-t ${{ IMAGE_NAME }}:latest \
.

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea/

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM debian:stable-slim
ARG FLUTTER_VERSION=3.32.3-stable
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y curl git unzip xz-utils zip libglu1-mesa
RUN apt-get install -y \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
ENV FLUTTER_HOME=/opt/flutter
ENV PATH="$FLUTTER_HOME/bin:$PATH"
# Download and extract Flutter SDK
RUN curl -L "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}.tar.xz" \
| tar -xJ -C /opt
RUN git config --global --add safe.directory /opt/flutter
RUN flutter --version
WORKDIR /workspace
CMD [ "bash" ]