Skip to content

Commit

Permalink
switch to main for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
lingawakad committed Dec 10, 2024
1 parent 8cff867 commit 6e25acc
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dockerfile
.dockerignore
**/.git*
**/example_plugins
**/gui
**/*.md
**/*.yaml
**/*.iss
49 changes: 49 additions & 0 deletions .github/workflows/docker-publish.yml
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 }}
40 changes: 40 additions & 0 deletions Dockerfile
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"]

0 comments on commit 6e25acc

Please sign in to comment.