-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cff867
commit 6e25acc
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Dockerfile | ||
.dockerignore | ||
**/.git* | ||
**/example_plugins | ||
**/gui | ||
**/*.md | ||
**/*.yaml | ||
**/*.iss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
branches: ['latest'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Get Release Tag | ||
id: get_release_tag | ||
run: echo "version=$(echo $GITHUB_REF | cut -d'/' -f3)" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/arm64,linux/amd64 | ||
push: true | ||
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=A relay between a Matrix.org room and a Meshtastic radio,org.opencontainers.image.title=MMRelay-Docker | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG python=python:3.9-slim | ||
|
||
# build stage | ||
FROM ${python} AS build | ||
|
||
RUN apt-get update \ | ||
&& apt-get install gcc -y | ||
|
||
RUN useradd mmrelay | ||
|
||
USER mmrelay | ||
|
||
ADD --chown=mmrelay:mmrelay https://github.com/geoffwhittington/meshtastic-matrix-relay.git /opt/mmrelay | ||
|
||
WORKDIR /opt/mmrelay | ||
ENV PATH="/opt/mmrelay/bin:$PATH" | ||
|
||
RUN python -m venv /opt/mmrelay \ | ||
&& python -m pip install --upgrade pip \ | ||
&& pip install -r requirements.txt | ||
|
||
# deploy stage | ||
FROM ${python} AS final | ||
|
||
RUN apt-get update \ | ||
&& apt-get install git -y | ||
|
||
RUN useradd mmrelay | ||
|
||
USER mmrelay | ||
|
||
WORKDIR /opt/mmrelay | ||
|
||
ENV PATH="/opt/mmrelay/bin:$PATH" | ||
|
||
COPY --chown=mmrelay:mmrelay --from=build /opt/mmrelay /opt/mmrelay | ||
|
||
CMD ["python", "main.py"] |