Skip to content
This repository was archived by the owner on Jun 8, 2025. It is now read-only.

Commit 8cea101

Browse files
Update Dockerfile & Readme to use **tags** at selecting flutter version
1 parent afe6def commit 8cea101

File tree

2 files changed

+41
-43
lines changed

2 files changed

+41
-43
lines changed

Dockerfile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#STEP 1: BUILD
12
# Environemnt to install flutter and build web
23
FROM debian:latest AS build-env
34

@@ -6,27 +7,28 @@ RUN apt-get update
67
RUN apt-get install -y curl git unzip
78

89
#define variables
9-
ARG FLUTTER_SDK=/usr/local/flutter
10-
ARG APP=/app/
10+
ARG FLUTTER_VERSION=3.13.0
11+
ARG FLUTTER_SDK_LOCATION=/usr/local/flutter
12+
ARG APP_LOCATION=/app/
1113

1214
#clone flutter
13-
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_SDK
15+
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_SDK_LOCATION
1416
#change dir to current flutter folder and make a checkout to the specific version
15-
RUN cd $FLUTTER_SDK && git checkout efbf63d9c66b9f6ec30e9ad4611189aa80003d31
17+
RUN cd $FLUTTER_SDK_LOCATION && git checkout tags/$FLUTTER_VERSION
1618

17-
#setup the flutter path as an enviromental variable
18-
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}"
19+
#setup the flutter path as an environment variable
20+
ENV PATH="$FLUTTER_SDK_LOCATION/bin:$FLUTTER_SDK_LOCATION/bin/cache/dart-sdk/bin:${PATH}"
1921

2022
#Start to run Flutter commands
21-
#doctor to see if all was installes ok
23+
#doctor to see if all was installed ok
2224
RUN flutter doctor -v
2325

2426
#create folder to copy source code
25-
RUN mkdir $APP
27+
RUN mkdir $APP_LOCATION
2628
#copy source code to folder
27-
COPY . $APP
29+
COPY . $APP_LOCATION
2830
#stup new folder as the working directory
29-
WORKDIR $APP
31+
WORKDIR $APP_LOCATION
3032

3133
#Run build: 1 - clean, 2 - pub get, 3 - build web
3234
RUN flutter clean
@@ -35,12 +37,13 @@ RUN flutter build web
3537

3638
#once heare the app will be compiled and ready to deploy
3739

40+
#STEP 2: DEPLOY
3841
#use nginx to deploy
3942
FROM nginx:1.25.2-alpine
4043

4144
#copy the info of the builded web app to nginx
4245
COPY --from=build-env /app/build/web /usr/share/nginx/html
4346

44-
#Expose and run nginx
47+
#Expose port and run nginx
4548
EXPOSE 80
4649
CMD ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,28 @@ RUN apt-get update
2525
RUN apt-get install -y curl git unzip
2626

2727
#define variables
28-
ARG FLUTTER_SDK=/usr/local/flutter
29-
ARG APP=/app/
28+
ARG FLUTTER_VERSION=3.13.0
29+
ARG FLUTTER_SDK_LOCATION=/usr/local/flutter
30+
ARG APP_LOCATION=/app/
3031

3132
#clone flutter
32-
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_SDK
33+
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_SDK_LOCATION
3334
#change dir to current flutter folder and make a checkout to the specific version
34-
RUN cd $FLUTTER_SDK && git checkout efbf63d9c66b9f6ec30e9ad4611189aa80003d31
35+
RUN cd $FLUTTER_SDK_LOCATION && git checkout tags/$FLUTTER_VERSION
3536

36-
#setup the flutter path as an enviromental variable
37-
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}"
37+
#setup the flutter path as an environment variable
38+
ENV PATH="$FLUTTER_SDK_LOCATION/bin:$FLUTTER_SDK_LOCATION/bin/cache/dart-sdk/bin:${PATH}"
3839

3940
#Start to run Flutter commands
40-
#doctor to see if all was installes ok
41+
#doctor to see if all was installed ok
4142
RUN flutter doctor -v
4243

4344
#create folder to copy source code
44-
RUN mkdir $APP
45+
RUN mkdir $APP_LOCATION
4546
#copy source code to folder
46-
COPY . $APP
47+
COPY . $APP_LOCATION
4748
#stup new folder as the working directory
48-
WORKDIR $APP
49+
WORKDIR $APP_LOCATION
4950

5051
#Run build: 1 - clean, 2 - pub get, 3 - build web
5152
RUN flutter clean
@@ -55,47 +56,41 @@ RUN flutter build web
5556
#once heare the app will be compiled and ready to deploy
5657

5758
#STEP 2: DEPLOY
58-
5959
#use nginx to deploy
6060
FROM nginx:1.25.2-alpine
6161

6262
#copy the info of the builded web app to nginx
6363
COPY --from=build-env /app/build/web /usr/share/nginx/html
6464

65-
#Expose and run nginx
65+
#Expose port and run nginx
6666
EXPOSE 80
6767
CMD ["nginx", "-g", "daemon off;"]
6868
```
6969

70-
### Use specific Flutter version
70+
### Use specific Flutter Version
71+
To use a specific version of Flutter, simply change the value of the `FLUTTER_VERSION` variable to a **tag** from the repository that represents the version you want to use. In this case the version 3.13.0 tag is being used.
72+
73+
### Use specific Flutter Checkout
7174

72-
If you want to use a specific version of Flutter for the build, you must modify the line:
75+
If you want to use a specific commit due to a fork or something, (IDK) you must modify the line:
7376

7477
```dockerfile
75-
RUN cd $FLUTTER_SDK && git checkout efbf63d9c66b9f6ec30e9ad4611189aa80003d31
78+
RUN cd $FLUTTER_SDK_LOCATION && git checkout tags/$FLUTTER_VERSION
7679
```
7780

78-
Modifying the git checkout **hash** (`efbf63d9c66b9f6ec30e9ad4611189aa80003d31` in this example) to
79-
the corresponding hash of the desired version.
81+
And replace it with:
8082

81-
Here are some of the latest stable versions and their corresponding hashes:
83+
```dockerfile
84+
RUN cd $FLUTTER_SDK_LOCATION && git checkout efbf63d9c66b9f6ec30e9ad4611189aa80003d31
85+
```
8286

83-
| Version | Name | Hash |
84-
| -------- | ------- | -------- |
85-
| 3.13.4 | [flutter_releases] Flutter stable 3.13.4 Framework Cherrypicks (#134599) | 367f9ea16bfae1ca451b9cc27c1366870b187ae2 |
86-
| 3.13.0 | [flutter_releases] Flutter stable 3.13.0 Framework Cherrypicks (#132610) | efbf63d9c66b9f6ec30e9ad4611189aa80003d31 |
87-
| 3.10.6 | [flutter_releases] Flutter stable 3.10.6 Framework Cherrypicks (#130446) | f468f3366c26a5092eb964a230ce7892fda8f2f8 |
88-
| 3.10.0 | [flutter_releases] Flutter stable 3.10.0 Framework Cherrypicks (#126304) | 84a1e904f44f9b0e9c4510138010edcc653163f8 |
89-
| 3.7.12 | [CP] Gradle 8.0 support in flutter 3.7 (#124990) | 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf |
90-
| 3.7.10 | [flutter_releases] Update Engine revision (...) for stable release 3.7.0 (#119030) | b06b8b2710955028a6b562f5aa6fe62941d6febf |
91-
| 3.3.10 | CP: ci.yaml changes for packaging (#117133) | 135454af32477f815a7525073027a3ff9eff1bfd |
87+
Then, modifying the git checkout **hash** (`efbf63d9c66b9f6ec30e9ad4611189aa80003d31` in this example) to
88+
the corresponding hash of the desired commit.
9289

93-
#### Obtain version hash
90+
#### Obtain version **tag** and **hash**
9491

9592
To obtain the hash of a specific version, you must go to
96-
the [flutter repo](https://github.com/flutter/flutter), deploy the **branches combo**, go to the **
97-
tags** tab, **select the tag** from the desired version, and **copy the hash** associated with the
98-
committee of that tag.
99-
, like this:
93+
the [flutter repo](https://github.com/flutter/flutter), deploy the **branches combo**, go to the **tags** tab, **select the tag** from the desired version, and **copy the hash** associated with the
94+
committee of that tag, like this:
10095

10196
![flutter-version-tag](flutter-version-tag.png)

0 commit comments

Comments
 (0)