-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2918d4c
commit ba5843e
Showing
5 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "flutter_docker", | ||
"context": "..", | ||
"dockerFile": "../Dockerfile", | ||
"remoteUser": "developer", | ||
"settings": { | ||
"terminal.integrated.shell.linux": null | ||
}, | ||
"runArgs": ["--privileged"], | ||
"extensions": ["dart-code.flutter"], | ||
"workspaceMount": "source=${localWorkspaceFolder}/workspace,target=/home/developer/workspace,type=bind,consistency=delegated", | ||
"workspaceFolder": "/home/developer/workspace" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Install Operating system and dependencies | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback python3 | ||
RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa openjdk-8-jdk wget | ||
RUN apt-get clean | ||
|
||
ENV DEBIAN_FRONTEND=dialog | ||
ENV PUB_HOSTED_URL=https://pub.flutter-io.cn | ||
ENV FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn | ||
|
||
# download Flutter SDK from Flutter Github repo | ||
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter | ||
|
||
# Set flutter environment path | ||
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}" | ||
|
||
# Run flutter doctor | ||
RUN flutter doctor | ||
|
||
# Enable flutter web | ||
RUN flutter channel master | ||
RUN flutter upgrade | ||
RUN flutter config --enable-web | ||
|
||
# Copy files to container and build | ||
RUN mkdir /app/ | ||
COPY . /app/ | ||
WORKDIR /app/ | ||
RUN flutter build web | ||
|
||
|
||
|
||
|
||
# Prepare Android directories and system variables | ||
RUN mkdir -p Android/sdk | ||
ENV ANDROID_SDK_ROOT /home/developer/Android/sdk | ||
RUN mkdir -p .android && touch .android/repositories.cfg | ||
|
||
# Set up Android SDK | ||
RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | ||
RUN unzip sdk-tools.zip && rm sdk-tools.zip | ||
RUN mv tools Android/sdk/tools | ||
RUN cd Android/sdk/tools/bin && yes | ./sdkmanager --licenses | ||
RUN cd Android/sdk/tools/bin && ./sdkmanager "build-tools;34.0.0" "platform-tools" "platforms;android-33" "sources;android-33" | ||
ENV PATH "$PATH:/home/developer/Android/sdk/platform-tools" | ||
|
||
# Record the exposed port | ||
EXPOSE 8001 | ||
|
||
# make server startup script executable and start the web server | ||
RUN ["chmod", "+x", "/app/server/server.sh"] | ||
|
||
ENTRYPOINT [ "/app/server/server.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: '4' | ||
|
||
services: | ||
frontend: | ||
build: | ||
context: ./ | ||
ports: | ||
- "8001" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# Define the port | ||
PORT=8001 | ||
|
||
# Check if the port is in use and release it if necessary. | ||
echo "Checking if port $PORT is in use..." | ||
if [ "$(lsof -t -i :$PORT)" ]; then | ||
echo "Port $PORT is in use. Stopping the process on that port..." | ||
fuser -k -n tcp $PORT | ||
fi | ||
|
||
# Switch to the web construction directory | ||
cd /app/build/web/ | ||
|
||
# Start the web server on the specified port | ||
echo "Starting the server on port $PORT..." | ||
python3 -m http.server $PORT |