Added Dockerfile for Flatpak repo-server & Build instructions under docs/ dir
This commit is contained in:
parent
4204974dd1
commit
9855d17345
98
docs/Flatpak_Build.md
Normal file
98
docs/Flatpak_Build.md
Normal file
|
@ -0,0 +1,98 @@
|
|||
# PyBitmessage Linux flatpak instructions
|
||||
|
||||
## Requirements
|
||||
First make sure you have `flatpak` and `flatpak-builder` installed. Follow the
|
||||
instructions for your distribution on [flathub](https://flatpak.org/setup/). The
|
||||
instructions there only cover the installation of `flatpak`, but
|
||||
`flatpak-builder` should be the same.
|
||||
|
||||
## Build and Install
|
||||
Once you have `flatpak` and `flatpak-builder` installed:
|
||||
|
||||
Build and Install the Base App
|
||||
|
||||
```
|
||||
git clone git://github.com/Bitmessage/PyBitmessage.git
|
||||
cd PyBitmessage/
|
||||
git submodule update --init --recursive
|
||||
flatpak-builder --install --install-deps-from=flathub --force-clean --state-dir=build/.flatpak-builder build/_baseApp packages/flatpak/org.bitmessage.BaseApp.json
|
||||
```
|
||||
This will install the base app to your local flatpak user repository, it
|
||||
takes a while to compile because QT4 and PyQt4 have to be build, among others. But this is only required once.
|
||||
|
||||
Now Build and Install PyBitmessage App
|
||||
|
||||
```
|
||||
flatpak-builder --install --install-deps-from=flathub --force-clean --state-dir=build/.flatpak-builder build/_PyBit packages/flatpak/org.bitmessage.PyBitmessage.json
|
||||
```
|
||||
|
||||
# Run
|
||||
When installation is done you can launch PyBitmessage via the **command line**:
|
||||
`flatpak run org.bitmessage.PyBitmessage`
|
||||
|
||||
Flatpak also exports a `.desktop` file, so you should be able to find and launch
|
||||
PyBitmessage via the **application launcher** of your Desktop (Gnome, KDE, ...).
|
||||
|
||||
# Export
|
||||
You can create a single file "bundle", which allows you to copy and install the
|
||||
PyBitmessage flatpak on other devices of the same architecture as the build machine.
|
||||
|
||||
## Create a local flatpak repository
|
||||
```
|
||||
flatpak-builder --repo=build/_flatpak_repo --force-clean --state-dir=build/.flatpak-builder build/_PyBit packages/flatpak/org.bitmessage.PyBitmessage.json
|
||||
```
|
||||
This will create a local flatpak repository in `build/_flatpak_repo/`.
|
||||
|
||||
## Hosting the repository
|
||||
|
||||
Place the `_flatpak_repo/` repo directory in the same directory as the dockerfile i.e `packages/flatpak/dockerfile`
|
||||
|
||||
Build and run the docker image
|
||||
|
||||
```
|
||||
docker build -t repo-server:latest .
|
||||
docker run -d -p 5000:5000 repo-server
|
||||
```
|
||||
|
||||
## Installing PyBitmessage from repo-server
|
||||
|
||||
Add the repository
|
||||
```
|
||||
sudo flatpak remote-add --no-gpg-verify pybitmessage http://localhost:5000/repo
|
||||
```
|
||||
|
||||
Install and Run the app
|
||||
```
|
||||
sudo flatpak install test org.bitmessage.PyBitmessage
|
||||
flatpak run org.bitmessage.PyBitmessage
|
||||
```
|
||||
|
||||
## Create a bundle
|
||||
```
|
||||
flatpak build-bundle build/_flatpak_repo build/pybitmessage.flatpak org.bitmessage.PyBitmessage
|
||||
```
|
||||
This will create a `pybitmessage.flatpak` bundle file in the `build/` directory.
|
||||
|
||||
This bundle can be copied to other systems or installed locally:
|
||||
```
|
||||
flatpak install pybitmessage.flatpak
|
||||
```
|
||||
|
||||
The application can be run using flatpak:
|
||||
```
|
||||
flatpak run org.bitmessage.PyBitmessage
|
||||
```
|
||||
|
||||
It can then be uninstalled with this command:
|
||||
```
|
||||
flatpak uninstall org.bitmessage.PyBitmessage
|
||||
```
|
||||
|
||||
This way of building an application is very convenient when preparing flatpaks
|
||||
for testing on another system of the same processor architecture.
|
||||
|
||||
## Cleanup
|
||||
If you want to free up disk space you can remove the `Sdk` runtime again:
|
||||
`flatpak uninstall org.freedesktop.Sdk//19.08`
|
||||
|
||||
You can also delete the `build` directory again.
|
19
packages/flatpak/dockerfile
Normal file
19
packages/flatpak/dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM ubuntu:20.04
|
||||
|
||||
MAINTANER Your Name "kuldeep.k@cisinlabs.com"
|
||||
|
||||
RUN apt-get update -y && \
|
||||
apt-get install -y python-pip python-dev
|
||||
|
||||
# We copy just the requirements.txt first to leverage Docker cache
|
||||
COPY ./requirements.txt /app/requirements.txt
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . /app
|
||||
|
||||
ENTRYPOINT [ "python" ]
|
||||
|
||||
CMD [ "server.py" ]
|
1
packages/flatpak/requirements.txt
Normal file
1
packages/flatpak/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
flask
|
10
packages/flatpak/server.py
Normal file
10
packages/flatpak/server.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from flask import Flask, send_from_directory
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/repo/<path:path>")
|
||||
def static_dir(path):
|
||||
return send_from_directory("repo", path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
Reference in New Issue
Block a user