From 49dab3e3cf16bafbf90d1b29736a5826fb1b1e96 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Fri, 4 Sep 2020 17:53:22 -0400 Subject: [PATCH 1/5] Dockerize web --- web/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 web/Dockerfile diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 00000000..ee34e66c --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,11 @@ +FROM node:14 as builder +RUN apt update && apt install -y protobuf-compiler +COPY protos protos +COPY web web +RUN protoc --proto_path=protos protos/* --js_out=web/src/protos +WORKDIR /web +RUN yarn install +RUN yarn build + +FROM nginx:alpine +COPY --from=builder /web/build/ /usr/share/nginx/html From 51a784b7e78bac00341ff8a635b0f75bf5d005ae Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Fri, 4 Sep 2020 18:28:49 -0400 Subject: [PATCH 2/5] Dockerize backend --- backend/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 backend/Dockerfile diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 00000000..cad7628c --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu as builder +RUN apt update && apt install -y protobuf-compiler +COPY protos protos +COPY backend backend +RUN protoc --proto_path=protos protos/* --python_out=backend/protos + +FROM python +COPY --from=builder /backend /backend +WORKDIR /backend +RUN pip install -r requirements.txt --no-cache-dir +ENTRYPOINT ["python", "app.py"] From b88871024556fbf722c29bf0a612d05fc8a425c2 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Fri, 4 Sep 2020 23:00:09 -0400 Subject: [PATCH 3/5] Optimize Docker --- backend/Dockerfile | 6 +++--- web/Dockerfile | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index cad7628c..97c0b228 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu as builder -RUN apt update && apt install -y protobuf-compiler +FROM namely/protoc-all as generator +WORKDIR / COPY protos protos COPY backend backend RUN protoc --proto_path=protos protos/* --python_out=backend/protos FROM python -COPY --from=builder /backend /backend +COPY --from=generator /backend /backend WORKDIR /backend RUN pip install -r requirements.txt --no-cache-dir ENTRYPOINT ["python", "app.py"] diff --git a/web/Dockerfile b/web/Dockerfile index ee34e66c..e4008934 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,8 +1,11 @@ -FROM node:14 as builder -RUN apt update && apt install -y protobuf-compiler +FROM namely/protoc-all as generator +WORKDIR / COPY protos protos COPY web web -RUN protoc --proto_path=protos protos/* --js_out=web/src/protos +RUN protoc --proto_path=protos protos/* --js_out=web/src/protos + +FROM node:14 as builder +COPY --from=generator /web /web WORKDIR /web RUN yarn install RUN yarn build From 285d356ee282610c8257efd866e199e28a9a5068 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Sat, 5 Sep 2020 00:31:02 -0400 Subject: [PATCH 4/5] Add action workflows for backend and web --- .github/workflows/backend.yml | 24 ++++++++++++++++++++++ .github/workflows/web.yml | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/backend.yml create mode 100644 .github/workflows/web.yml diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 00000000..982a55c7 --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,24 @@ +name: Backend + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + release: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v2 + - uses: docker/build-push-action@v1 + with: + dockerfile: backend/Dockerfile + username: ${{ github.actor }} + password: ${{ github.token }} + registry: docker.pkg.github.com/polycortex/polydodo + repository: backend + tags: latest diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 00000000..f84c8195 --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,38 @@ +name: Web + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: abelfodil/protoc-action@v1 + - uses: borales/actions-yarn@v2.3.0 + with: + cmd: --cwd web install + - run: protoc --proto_path=protos protos/* --js_out=web/src/protos + - uses: borales/actions-yarn@v2.3.0 + with: + cmd: --cwd web build + + release: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v2 + - uses: docker/build-push-action@v1 + with: + dockerfile: web/Dockerfile + username: ${{ github.actor }} + password: ${{ github.token }} + registry: docker.pkg.github.com/polycortex/polydodo + repository: web + tags: latest From 19c8ab69a26de1aa03c133a9a0fdeac5e3453b74 Mon Sep 17 00:00:00 2001 From: Anes Belfodil Date: Sat, 5 Sep 2020 00:30:56 -0400 Subject: [PATCH 5/5] Add mobile workflow --- .github/workflows/mobile.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/mobile.yml diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml new file mode 100644 index 00000000..1508c38b --- /dev/null +++ b/.github/workflows/mobile.yml @@ -0,0 +1,45 @@ +name: Mobile + +on: + push: + branches: + - master + pull_request: + branches: + - master + +defaults: + run: + working-directory: mobile + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v1 + - uses: abelfodil/protoc-action@v1 + with: + enable-dart: true + + - run: protoc --proto_path=protos protos/* --dart_out=mobile/lib/protos + working-directory: . + + - run: flutter pub get + + - run: flutter test + + - run: flutter build apk + - uses: actions/upload-artifact@v2 + with: + name: Android app + path: mobile/build/app/outputs/flutter-apk/app-release.apk + + - run: flutter build ios --release --no-codesign + - uses: actions/upload-artifact@v2 + with: + name: iOS app + path: mobile/build/ios/iphoneos/Runner.app