Skip to content

Commit

Permalink
Merge branch 'docker-compose'
Browse files Browse the repository at this point in the history
  • Loading branch information
tcd93 committed Sep 11, 2023
2 parents 0ca047c + 4d5a115 commit a2f59e8
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 40 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM debian:stable

WORKDIR /usr/vscode

ENV ANDROID_HOME="/usr/lib/android-sdk"
# install Android sdk & cmdline tools without Android Studio
RUN apt-get update && \
apt-get install -y wget tar xz-utils unzip git && \
apt-get install -y android-sdk && \
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip && \
unzip commandlinetools-linux-10406996_latest.zip && \
mkdir -p "${ANDROID_HOME}/cmdline-tools/latest" && \
mv cmdline-tools/* "${ANDROID_HOME}/cmdline-tools/latest" && \
rm -rf cmdline-tools

ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${PATH}"
RUN yes | sdkmanager --licenses && sdkmanager --install "platforms;android-33"

# download and extract to "flutter" folder
RUN wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.13.3-stable.tar.xz && \
tar vxfo flutter_linux_3.13.3-stable.tar.xz

ENV PATH="${PATH}:/usr/vscode/flutter/bin"
84 changes: 45 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
# Simple-POS

### ❤️❤️ [Online Demo](https://tcd93.github.io/flutter-pos)❤️❤️

A mobile POS written in _Flutter_, suitable for small cafe/restaurant, fully offline.

**Tested & printable on **Sunmi V1S** device.**

![sunmi_v1s](.github/resource/print.jpg)

**Support:**

- Android
- Web (unable to print)
- English & Vietnamese (auto detect Locale)

---

## Install & Run

Get [flutter](https://flutter.dev/) 3.10

```
flutter pub get
flutter run
```

**For web**
1. `flutter run -d chrome`

**For Android**
**Requirement: JAVA sdk >=18**
1. `flutter run`

## Testing
`flutter test`

## TODO
- [ ] Remote printing? (via Bluetooth)
# Simple-POS

### ❤️❤️ [Online Demo](https://tcd93.github.io/flutter-pos)❤️❤️

A mobile POS written in _Flutter_, suitable for small cafe/restaurant, fully offline.

**Tested & printable on **Sunmi V1S** device.**

![sunmi_v1s](.github/resource/print.jpg)

**Support:**

- Android
- Web (unable to print)
- English & Vietnamese (auto detect Locale)

---

## Install & Run

Get [flutter](https://flutter.dev/)
**IMPORTANT: this project works only with Flutter >= 3.10**

```
flutter pub get
flutter run
```

### Running inside WSL2
##### Use **Docker for Destop**'s _Dev Environment_ (note that usbip over Docker Desktop, as of now, hasn't work; you can try debugging over ADB tcpip)
Or
##### Run Docker containers inside of WSL2
1. Build image and run container: `docker-compose -f .\compose-dev.yaml up -d --build`
2. SSH inside: `docker exec -it flutter_dev bash`
3. Accept licences: `flutter doctor --android-licenses`
4. Clean: `flutter clean`
5. Run:
- Web: `flutter run -d web-server` (Visual studio code should forward the port automatically if you use _Remote window_)
- USB-connected Android device: follow the instruction [here](https://learn.microsoft.com/en-us/windows/wsl/connect-usb) to connect your phone into WSL2, remember to kill the running ADB server on your Windows host machine first

## Testing
`flutter test`

## TODO
- [ ] Remote printing? (via Bluetooth)
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
16 changes: 16 additions & 0 deletions compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
flutter:
container_name: flutter_dev
privileged: true
entrypoint:
- sleep
- infinity
build: .
init: true
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
- ./:/usr/vscode/pos_app
- ./:/com.docker.devenvironments.code
working_dir: /usr/vscode/pos_app

0 comments on commit a2f59e8

Please sign in to comment.