diff --git a/.gitignore b/.gitignore index dce8daf..06a1aa3 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ firebase_options.dart google-services.json GoogleService-Info.plist src/lib/tests/* -scripts/ \ No newline at end of file +scripts/ +.env diff --git a/Dockerfile b/Dockerfile index faf7471..2ec6116 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,16 @@ # Install Operating System FROM ubuntu:20.04 AS build-env +# Set build arguments +ARG PROJECT_ID +ARG FIREBASE_TOKEN + # Disable interactive mode ENV DEBIAN_FRONTEND noninteractive # Prerequisites RUN apt-get update -RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3 sed +RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3 sed sudo RUN apt-get clean # Download Flutter SDK from Flutter Github repo @@ -23,10 +27,20 @@ RUN flutter channel master RUN flutter upgrade RUN flutter config --enable-web -# Copy files to container and build +# Copy files to container and set working directory RUN mkdir /app/ COPY . /app/ WORKDIR /app/src/ + +# Get Firebase CLI +RUN curl -sL https://firebase.tools | bash + +# Setup FlutterFire +RUN dart pub global activate flutterfire_cli +ENV PATH="/root/.pub-cache/bin:${PATH}" +RUN flutterfire configure -t ${FIREBASE_TOKEN} -p ${PROJECT_ID} -y + +# Build Flutter Web RUN flutter build web # Create the run-time image diff --git a/README.md b/README.md index 7c97d8a..52dd9b2 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,56 @@ -# asl +# ASLearner [![Website](https://img.shields.io/website?label=aslearner.apps.science.ontariotechu.ca&style=for-the-badge&url=https%3A%2F%2Faslearner.apps.science.ontariotechu.ca)](https://aslearner.apps.science.ontariotechu.ca/) -An ASL Learning app. +An American Sign Language Learning app. -## How to run project +## Contributing, Selh-Hosting, and Deploying -Debugging: `flutter run -d chrome --web-hostname localhost --web-port 7357` +### Setting everything up -Deploying: +1. [Fork the repository.](https://github.com/SethCohen/ASLearner/fork) +2. [Create and setup your own Firebase project.](https://firebase.google.com/docs/web/setup) +3. Configure Flutter for Firebase Web + 1. `$ cd src` + 2. `$ firebase login` + 3. `$ dart pub global activate flutterfire_cli` +4. [Setup Firestore](https://firebase.google.com/docs/firestore/quickstart) and add some sample data with the following structure. -1. Run `docker build . -t flutter_docker` in terminal. -2. Run `docker run --rm -d -p 7357:80/tcp flutter_docker:latest` in terminal. + 1. ```yaml + decks/ + + cardCount: int + description: string + title: string + cards/ + + image: string + instructions: string + title: string + type: string="immutable" + users/ + ``` + +5. [Setup Google Sign In Web](https://pub.dev/packages/google_sign_in_web#usage) + 1. Edit `src/web/index.html` and replace ``. + +### Running the project + +#### Debugging + +1. `$ flutter run -d chrome --web-hostname localhost --web-port 7357` + +#### Deploying using docker + +1. Create a `.env` file + +```yaml +PROJECT_ID="YOUR_FIREBASE_PROJECT_ID_HERE" +FIREBASE_TOKEN="YOUR_FIREBASE_TOKEN_HERE" # Generated from $ firebase login:ci +``` + +2. `$ docker compose build` 3. Go to `http://localhost:7357/` in browser. -or alternatively +### Contributing -1. Run `flutter build web` in terminal. -2. Run `python -m http.server 7357` in terminal. -3. Go to `http://localhost:7357/build/web/` in browser. +1. Make your changes. +2. Submit a pull request. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..30422eb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.9' +services: + aslearner: + build: + context: . + dockerfile: Dockerfile + args: + PROJECT_ID: ${PROJECT_ID} + FIREBASE_TOKEN: ${FIREBASE_TOKEN} + env_file: .env + ports: + - "7357:80"