Skip to content

Commit d99f778

Browse files
committed
feat: added dockerfile for linux and android
1 parent d1d4ca2 commit d99f778

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

Dockerfile.android

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:18.04
2+
3+
RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa openjdk-8-jdk wget
4+
5+
RUN useradd -ms /bin/bash developer
6+
USER developer
7+
WORKDIR /home/developer
8+
9+
RUN mkdir -p Android/sdk
10+
ENV ANDROID_SDK_ROOT /home/developer/Android/sdk
11+
RUN mkdir -p .android && touch .android/repositories.cfg
12+
13+
14+
15+
# Set up Android SDK
16+
RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
17+
RUN unzip sdk-tools.zip && rm sdk-tools.zip
18+
RUN mv tools Android/sdk/tools
19+
RUN cd Android/sdk/tools/bin && yes | ./sdkmanager --licenses
20+
RUN cd Android/sdk/tools/bin && ./sdkmanager "build-tools;29.0.2" "patcher;v4" "platform-tools" "platforms;android-29" "sources;android-29"
21+
ENV PATH "$PATH:/home/developer/Android/sdk/platform-tools"
22+
23+
RUN git clone https://github.com/flutter/flutter.git
24+
ENV PATH "$PATH:/home/developer/flutter/bin"
25+
RUN flutter doctor

Dockerfile.linux

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ghcr.io/cirruslabs/flutter:3.24.5
2+
3+
WORKDIR /app
4+
5+
COPY . /app
6+
7+
# Install dependencies for Flutter Linux desktop development
8+
RUN apt-get update && apt-get install -y \
9+
libgtk-3-dev \
10+
libblkid-dev \
11+
liblzma-dev \
12+
liblzma5 \
13+
libnss3 \
14+
libx11-dev \
15+
libxkbfile-dev \
16+
libcurl4-openssl-dev \
17+
xdg-utils \
18+
cmake \
19+
ninja-build \
20+
clang \
21+
&& apt-get clean
22+
23+
RUN flutter doctor
24+
25+
RUN flutter config --enable-linux-desktop
26+
RUN flutter clean
27+
RUN flutter pub get

docker-compose.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: "3.9"
2+
services:
3+
flutter_linux:
4+
profiles:
5+
- linux
6+
build:
7+
context: .
8+
dockerfile: Dockerfile.linux
9+
environment:
10+
- DISPLAY=${DISPLAY}
11+
volumes:
12+
- .:/app
13+
network_mode: "host" # Use host networking
14+
command: ["bash", "-c", "flutter clean && flutter run -d linux"]
15+
flutter_android:
16+
profiles:
17+
- android
18+
build:
19+
context: .
20+
dockerfile: Dockerfile.android
21+
environment:
22+
- DISPLAY=${DISPLAY}
23+
volumes:
24+
- .:/app
25+
network_mode: "host" # Use host networking
26+
command: ["bash", "-c", "flutter run -d android"]

0 commit comments

Comments
 (0)