mirror of
https://github.com/markqvist/NomadNet.git
synced 2024-10-01 01:26:07 -04:00
Automated docker build for nomadnet daemon
Uses a Github Action (`.github/workflows/publish-container.yml`) to create a docker container image (from `Dockerfile`) that represents an extremely minimal python installation with a virtualenv holding all requirements necessary to execute `nomadnet`. New docker images are created on pushes to `master` or pushes to tags matching `*.*.*` (ie. version tags) and are retrievable with those tags. Examples: ```sh $ docker pull ghcr.io/markqvist/nomadnet:master # Print docker labels, to demonstrate the image has been retrieved $ docker inspect -f '{{json .Config.Labels}}' ghcr.io/markqvist/nomadnet:master | jq { "org.opencontainers.image.created": "2022-04-27T06:01:55.894Z", "org.opencontainers.image.description": "Communicate Freely", "org.opencontainers.image.licenses": "GPL-3.0", "org.opencontainers.image.revision": "59cffc4a9de0f276d2cc87537ff1316aed5f16dd", "org.opencontainers.image.source": "https://github.com/markqvist/NomadNet", "org.opencontainers.image.title": "NomadNet", "org.opencontainers.image.url": "https://github.com/markqvist/NomadNet", "org.opencontainers.image.version": "master" } # Run nomadnet interactively without installing it (with default config) $ docker run -it ghcr.io/markqvist/nomadnet:master # Run nomadnet as a daemon, using config stored on the host machine in specific directories $ docker run -d -v /local/path/nomadnetconfig/:/root/.nomadnetwork/ -v /local/path/reticulumconfig/:/root/.reticulum/:rw ghcr.io/markqvist/nomadnet:master ``` # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Tue Apr 26 23:50:22 2022 +0100 # # On branch dockerfile # Changes to be committed: # new file: .dockerignore # new file: .github/workflows/publish-container.yml # new file: Dockerfile # modified: README.md # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Tue Apr 26 23:50:22 2022 +0100 # # On branch dockerfile # Changes to be committed: # new file: .dockerignore # new file: .github/workflows/publish-container.yml # new file: Dockerfile # modified: README.md # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Tue Apr 26 23:50:22 2022 +0100 # # On branch dockerfile # Changes to be committed: # new file: .dockerignore # new file: .github/workflows/publish-container.yml # new file: Dockerfile # modified: README.md #
This commit is contained in:
parent
34b377bafe
commit
a917cbf010
1
.dockerignore
Symbolic link
1
.dockerignore
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
.gitignore
|
42
.github/workflows/publish-container.yml
vendored
Normal file
42
.github/workflows/publish-container.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['master']
|
||||||
|
tags: ['*.*.*']
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
FROM python:3.11-rc-alpine3.14 as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache build-base linux-headers libffi-dev cargo
|
||||||
|
|
||||||
|
# Create a virtualenv that we'll copy to the published image
|
||||||
|
RUN python -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
RUN pip3 install setuptools-rust pyopenssl cryptography
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
RUN cd /app/ && python3 setup.py install
|
||||||
|
|
||||||
|
# Use multi-stage build, as we don't need rust compilation on the final image
|
||||||
|
FROM python:3.11-rc-alpine3.14
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.documentation="https://github.com/jphastings/NomadNet#using-docker--running-a-daemon"
|
||||||
|
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
COPY --from=build /opt/venv /opt/venv
|
||||||
|
|
||||||
|
VOLUME /root/.reticulum
|
||||||
|
VOLUME /root/.nomadnetwork
|
||||||
|
|
||||||
|
ENTRYPOINT ["nomadnet"]
|
22
README.md
22
README.md
@ -53,6 +53,28 @@ You can install Nomad Network on Android using Termux, but there's a few more co
|
|||||||
|
|
||||||
For a native Android application with a graphical user interface, have a look at [Sideband](https://unsigned.io/sideband).
|
For a native Android application with a graphical user interface, have a look at [Sideband](https://unsigned.io/sideband).
|
||||||
|
|
||||||
|
### Using docker / running a daemon
|
||||||
|
|
||||||
|
Nomad Network is automatically published as a docker image on Github Packages. Image tags are one of either `master` (for the latest release) or the version number (eg `0.1.7`) for the specified version number (as tagged in this git repo).
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ docker pull ghcr.io/markqvist/nomadnet:master
|
||||||
|
|
||||||
|
# Run nomadnet interactively without installing it (with default config)
|
||||||
|
$ docker run -it ghcr.io/markqvist/nomadnet:master
|
||||||
|
|
||||||
|
# Run nomadnet as a daemon, using config stored on the host machine in specific
|
||||||
|
# directories, and allowing access to specific numbered ports openned by nomadnet
|
||||||
|
# on the host machine on the same port numbers.
|
||||||
|
$ docker run -d \
|
||||||
|
-v /local/path/nomadnetconfig/:/root/.nomadnetwork/ \
|
||||||
|
-v /local/path/reticulumconfig/:/root/.reticulum/ \
|
||||||
|
-p 37428:37428 \
|
||||||
|
-p 37429:37429 \
|
||||||
|
ghcr.io/markqvist/nomadnet:master
|
||||||
|
```
|
||||||
|
|
||||||
## Help & Discussion
|
## Help & Discussion
|
||||||
|
|
||||||
For help requests, discussion, sharing ideas or anything else related to Nomad Network, please have a look at the [Nomad Network discussions pages](https://github.com/markqvist/Reticulum/discussions/categories/nomad-network).
|
For help requests, discussion, sharing ideas or anything else related to Nomad Network, please have a look at the [Nomad Network discussions pages](https://github.com/markqvist/Reticulum/discussions/categories/nomad-network).
|
||||||
|
Loading…
Reference in New Issue
Block a user