Skip to content

Commit

Permalink
Version by Android SDK explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Nov 5, 2021
1 parent 2d5854c commit 8247f81
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 16 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ All user visible changes to this project will be documented in this file. This p



## [2.5.3-androidsdk30-r0] · 2021-11-05
[2.5.3-androidsdk30-r0]: /../../tree/2.5.3-androidsdk30-r0

[Diff](/../../compare/2.5.3-r0...2.5.3-androidsdk30-r0)

### Added

- Explicitly versioning for [Android SDK].
- `Web` [Flutter] toolchain supported.
- Prefetched tools for supported [Flutter] toolchains.




## [2.5.3-r0] · 2021-11-04
[2.5.3-r0]: /../../tree/2.5.3-r0

Expand All @@ -18,5 +32,6 @@ All user visible changes to this project will be documented in this file. This p



[Android SDK]: https://developer.android.com/studio
[Flutter]: https://flutter.dev
[Semantic Versioning 2.0.0]: https://semver.org
42 changes: 30 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
# https://hub.docker.com/r/cirrusci/flutter
# https://github.com/cirruslabs/docker-images-flutter/blob/master/sdk/Dockerfile
ARG flutter_ver=2.5.3
FROM cirrusci/flutter:${flutter_ver}
# https://hub.docker.com/r/cirrusci/android-sdk
# https://github.com/cirruslabs/docker-images-android/blob/master/sdk/30/Dockerfile
ARG android_sdk_ver=30
FROM cirrusci/android-sdk:${android_sdk_ver}

ARG flutter_ver=2.5.3
ARG build_rev=0

LABEL org.opencontainers.image.source="\
https://github.com/instrumentisto/flutter-docker-image"


# Install dependencies
# Install Flutter
ENV FLUTTER_HOME=/usr/local/flutter \
FLUTTER_VERSION=${flutter_ver} \
PATH=$PATH:/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
&& update-ca-certificates \
\
# Install dependencies for Linux toolchain
&& apt-get install -y --no-install-recommends --no-install-suggests \
build-essential \
clang cmake \
lcov \
libgtk-3-dev liblzma-dev \
ninja-build \
pkg-config \
# Cleanup unnecessary stuff
&& rm -rf /var/lib/apt/lists/*

# Enable Android and Linux support
RUN flutter config --enable-android \
&& flutter config --enable-linux-desktop
\
# Install Flutter itself
&& curl -fL -o /tmp/flutter.tar.xz \
https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${flutter_ver}-stable.tar.xz \
&& tar -xf /tmp/flutter.tar.xz -C /usr/local/ \
&& flutter config --enable-android \
--enable-linux-desktop \
--enable-web \
--no-enable-ios \
&& flutter precache --universal --linux --web --no-ios \
&& (yes | flutter doctor --android-licenses) \
\
&& rm -rf /var/lib/apt/lists/* \
/tmp/*
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\

FLUTTER_VER ?= $(strip \
$(shell grep 'ARG flutter_ver=' Dockerfile | cut -d '=' -f2))
ANDROID_SDK_VER ?= $(strip \
$(shell grep 'ARG android_sdk_ver=' Dockerfile | cut -d '=' -f2))
BUILD_REV ?= $(strip \
$(shell grep 'ARG build_rev=' Dockerfile | cut -d '=' -f2))

NAMESPACES := instrumentisto \
ghcr.io/instrumentisto \
quay.io/instrumentisto
NAME := flutter
TAGS ?= $(FLUTTER_VER)-r$(BUILD_REV) \
TAGS ?= $(FLUTTER_VER)-androidsdk$(ANDROID_SDK_VER)-r$(BUILD_REV) \
$(FLUTTER_VER) \
$(strip $(shell echo $(FLUTTER_VER) | cut -d '.' -f1,2)) \
$(strip $(shell echo $(FLUTTER_VER) | cut -d '.' -f1)) \
Expand Down Expand Up @@ -72,6 +74,7 @@ docker.image:
docker build --network=host --force-rm \
$(if $(call eq,$(no-cache),yes),--no-cache --pull,) \
--build-arg flutter_ver=$(FLUTTER_VER) \
--build-arg android_sdk_ver=$(ANDROID_SDK_VER) \
--build-arg build_rev=$(BUILD_REV) \
-t instrumentisto/$(NAME):$(or $(tag),$(VERSION)) ./

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Flutter Docker image

[Changelog](https://github.com/instrumentisto/flutter-docker-image/blob/master/CHANGELOG.md)

Based on [`cirrusci/flutter` Docker image][2].
Based on [`cirrusci/android-sdk` Docker image][2].




## Supported tags and respective `Dockerfile` links

- [`2.5.3-r0`, `2.5.3`, `2.5`, `2`, `latest`][201]
- [`2.5.3-androidsdk30-r0`, `2.5.3`, `2.5`, `2`, `latest`][201]



Expand All @@ -27,6 +27,7 @@ Based on [`cirrusci/flutter` Docker image][2].

- `Android`
- `Linux`
- `Web`



Expand Down Expand Up @@ -107,7 +108,7 @@ If you have any problems with or questions about this image, please contact us t
[DockerHub]: https://hub.docker.com
[Flutter]: https://flutter.dev

[2]: https://hub.docker.com/r/cirrusci/flutter
[2]: https://hub.docker.com/r/cirrusci/android-sdk

[80]: https://github.com/instrumentisto/flutter-docker-image/issues
[90]: https://github.com/instrumentisto/flutter-docker-image
Expand Down
24 changes: 24 additions & 0 deletions tests/main.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@
[ "$status" -eq 0 ]
}

@test "flutter has correct version" {
run docker run --rm --entrypoint sh $IMAGE -c \
"flutter --version | grep 'Flutter ' | cut -d ' ' -f 2 | tr -d ' '"
[ "$status" -eq 0 ]
[ "$output" != '' ]
actual="$output"

run sh -c "cat Dockerfile | grep 'ARG flutter_ver=' \
| cut -d '=' -f 2 \
| tr -d ' '"
[ "$status" -eq 0 ]
[ "$output" != '' ]
expected="$output"

[ "$actual" == "$expected" ]
}


@test "Android toolchain is enabled" {
run docker run --rm --entrypoint sh $IMAGE -c \
Expand Down Expand Up @@ -59,3 +76,10 @@
[ "$status" -eq 0 ]
[[ "$output" == *"[✓] Linux toolchain"* ]]
}


@test "Web toolchain is enabled" {
run docker run --rm --entrypoint sh $IMAGE -c \
'flutter config | grep "enable-web: true"'
[ "$status" -eq 0 ]
}

0 comments on commit 8247f81

Please sign in to comment.