-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
62 lines (43 loc) · 1.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
FROM ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y curl git unzip android-sdk nginx wget
# Download cmdtools for android sdk
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip && \
unzip commandlinetools-linux-7583922_latest.zip && \
rm commandlinetools-linux-7583922_latest.zip
# Install cmdtools in the right location
RUN mkdir -p /usr/lib/android-sdk/cmdline-tools/latest && \
mv cmdline-tools/* /usr/lib/android-sdk/cmdline-tools/latest && \
rm -rf cmdline-tools
# Start the nginx server
RUN service nginx start
# Clone the flutter repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web
# Run flutter doctor
RUN flutter doctor -v
# Set the working directory to the app files within the container
WORKDIR /flutter
COPY . /flutter
# Clean the Project
RUN flutter clean
# Get App Dependencies
RUN flutter pub get
# Accept licenses
RUN yes | flutter doctor --android-licenses
# Build the app for the mobile
RUN flutter build apk
# Build the app for the web
RUN flutter build web
# Clean the serving directory
RUN rm /var/www/html/*
# Copy the flutter web to where nginx serves
RUN cp -r /flutter/build/web /var/www/html
# Document the exposed port
EXPOSE 80