Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,46 @@ on:
- master

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

defaults:
run:
working-directory: backend

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python -m pip install -r requirements.txt -r requirements-dev.txt
- run: python -m PyInstaller --onefile app.py
- uses: actions/upload-artifact@v2
with:
name: "server_${{ matrix.os }}"
path: backend/dist

release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'

strategy:
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}

needs: build

steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: "server_${{ matrix.os }}"
path: backend/dist
- uses: docker/build-push-action@v1
with:
dockerfile: backend/Dockerfile
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ This projects aims to offer a comprehensive guide to **record polysomnographic E
- Fetch Flutter dependencies through the `Flutter` extension
- Start dev server by running `python backend/app.py`

## Building the server as a single executable

Run `python -m PyInstaller --onefile app.py`

## Running the server locally

- [Login](https://docs.github.com/en/free-pro-team@latest/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-with-a-personal-access-token) to Github Docker registry
Expand Down
9 changes: 4 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM python
COPY backend /backend
WORKDIR /backend
RUN pip3 install -r requirements.txt --no-cache-dir
CMD ["python", "app.py"]
FROM ubuntu
COPY backend/dist/ /
RUN chmod +x /app
CMD /app
1 change: 1 addition & 0 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyinstaller==4.0