Skip to content

Commit

Permalink
chore: enable weekly build of flutter Dev Container
Browse files Browse the repository at this point in the history
This commit configures a scheduled GitHub Workflow to periodically build
and push the Dev Container image into the GitHub Container Registry.
This allows to use the prebuilt image directly, thereby dramatically
reducing the time to start and open the project in the Dev Container.
  • Loading branch information
ZauberNerd committed Jan 5, 2025
1 parent 0fbe542 commit 52afd7f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"image": "ghcr.io/fossasia/flutter-devcontainer:latest",
// Or build locally
// "build": {
// "dockerfile": "Dockerfile"
// },
"runArgs": [
"--add-host",
"host.docker.internal:host-gateway",
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Dev Container

on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:

jobs:
devcontainer:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build dev container image
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ github.repository_owner }}/flutter-devcontainer
imageTag: latest
cacheFrom: ghcr.io/${{ github.repository_owner }}/flutter-devcontainer:latest
push: always

0 comments on commit 52afd7f

Please sign in to comment.