Skip to content

Commit c42c84c

Browse files
committed
initial commit
0 parents  commit c42c84c

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Docker
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
# Publish semver tags as releases.
12+
tags: [ 'v*.*.*' ]
13+
14+
env:
15+
# Use docker.io for Docker Hub if empty
16+
REGISTRY: ghcr.io
17+
# github.repository as <account>/<repo>
18+
IMAGE_NAME: ${{ github.repository }}
19+
20+
21+
jobs:
22+
build:
23+
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
packages: write
28+
# This is used to complete the identity challenge
29+
# with sigstore/fulcio when running outside of PRs.
30+
id-token: write
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
# Install the cosign tool except on PR
37+
# https://github.com/sigstore/cosign-installer
38+
- name: Install cosign
39+
if: github.event_name != 'pull_request'
40+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
41+
with:
42+
cosign-release: 'v2.2.4'
43+
44+
# Set up BuildKit Docker container builder to be able to build
45+
# multi-platform images and export cache
46+
# https://github.com/docker/setup-buildx-action
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
49+
50+
# Login against a Docker registry except on PR
51+
# https://github.com/docker/login-action
52+
- name: Log into registry ${{ env.REGISTRY }}
53+
if: github.event_name != 'pull_request'
54+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
55+
with:
56+
registry: ${{ env.REGISTRY }}
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
# Extract metadata (tags, labels) for Docker
61+
# https://github.com/docker/metadata-action
62+
- name: Extract Docker metadata
63+
id: meta
64+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
65+
with:
66+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
67+
68+
# Build and push Docker image with Buildx (don't push on PR)
69+
# https://github.com/docker/build-push-action
70+
- name: Build and push Docker image
71+
id: build-and-push
72+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
73+
with:
74+
context: .
75+
push: ${{ github.event_name != 'pull_request' }}
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max
80+
81+
# Sign the resulting Docker image digest except on PRs.
82+
# This will only write to the public Rekor transparency log when the Docker
83+
# repository is public to avoid leaking data. If you would like to publish
84+
# transparency data even for private images, pass --force to cosign below.
85+
# https://github.com/sigstore/cosign
86+
- name: Sign the published Docker image
87+
if: ${{ github.event_name != 'pull_request' }}
88+
env:
89+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
90+
TAGS: ${{ steps.meta.outputs.tags }}
91+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
92+
# This step uses the identity token to provision an ephemeral certificate
93+
# against the sigstore community Fulcio instance.
94+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# flutter docker image version from https://github.com/cirruslabs/docker-images-flutter/pkgs/container/flutter : *stable* version (no 'pre' or 'beta')
2+
FROM ghcr.io/cirruslabs/flutter:3.27.2
3+
4+
# Conf
5+
## Google Cloud CLI filename + hash from https://cloud.google.com/sdk/docs/downloads-versioned-archives (Linux 64-bit (x86_64) version)
6+
ENV GCLOUD_TGZ="google-cloud-cli-linux-x86_64.tar.gz"
7+
ENV GCLOUD_TGZ_URL="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${GCLOUD_TGZ}"
8+
ENV GCLOUD_TGZ_HASH="382bff10fca6f72570d138a9903c3e49ad3a1eb488d5494356051136e3906a71"
9+
10+
## --- END OF VARIABLES TO CHANGE FOR UPDATE ---
11+
12+
# Download (if necessary) & install GCloud CLI
13+
RUN mkdir /google-cloud-cli
14+
WORKDIR "/google-cloud-cli"
15+
RUN curl -O "${GCLOUD_TGZ_URL}"
16+
RUN echo "${GCLOUD_TGZ_HASH} ${GCLOUD_TGZ}" | shasum -a 256 -c - # the double space is required
17+
RUN tar -xzf "${GCLOUD_TGZ}"
18+
RUN ./google-cloud-sdk/install.sh --quiet # --quiet to avoid interactive prompts
19+
ENV PATH="${PATH}:/google-cloud-cli/bin"
20+
21+
# Install deps for ffigen
22+
RUN apt-get update -y
23+
RUN apt-get install -y llvm libclang-dev
24+
25+
# cleanup
26+
RUN rm -rf /var/lib/apt/lists/*
27+
RUN rm "/google-cloud-cli/${GCLOUD_TGZ}"
28+
29+
WORKDIR "/"

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Docker Flutter
2+
Docker image for Flutter Android development.
3+
Based on ghcr.io/cirruslabs/flutter
4+
5+
6+
## This image includes:
7+
- Android SDK
8+
- Flutter SDK
9+
- Google Cloud CLI
10+
- Dependencies for ffigen (llvm & libclang-dev)

0 commit comments

Comments
 (0)