mirror of
https://github.com/Wonderfall/docker-synapse.git
synced 2025-06-13 01:12:50 -04:00
Add Mjolnir module and update workflow
Signed-off-by: Tommy <contact@tommytran.io>
This commit is contained in:
parent
de51202503
commit
09baed1218
4 changed files with 33 additions and 31 deletions
|
@ -1,17 +1,17 @@
|
||||||
name: build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
schedule:
|
schedule:
|
||||||
# Build the image regularly (each Friday)
|
# Build the image regularly (each Saturday)
|
||||||
- cron: '13 21 * * 5'
|
- cron: '0 22 * * 6'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build, scan & push
|
name: Build, scan & push
|
||||||
runs-on: "ubuntu-20.04"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -19,15 +19,15 @@ jobs:
|
||||||
- name: Build an image from Dockerfile
|
- name: Build an image from Dockerfile
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
-t ghcr.io/wonderfall/synapse \
|
-t ghcr.io/tommytran732/synapse \
|
||||||
-t ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c6) \
|
-t ghcr.io/tommytran732/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c6) \
|
||||||
-t ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c4) \
|
-t ghcr.io/tommytran732/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c4) \
|
||||||
.
|
.
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'ghcr.io/wonderfall/synapse'
|
image-ref: 'ghcr.io/tommytran732/synapse'
|
||||||
format: 'template'
|
format: 'template'
|
||||||
template: '@/contrib/sarif.tpl'
|
template: '@/contrib/sarif.tpl'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
|
@ -46,6 +46,6 @@ jobs:
|
||||||
|
|
||||||
- name: Push image to GitHub
|
- name: Push image to GitHub
|
||||||
run: |
|
run: |
|
||||||
docker push ghcr.io/wonderfall/synapse
|
docker push ghcr.io/tommytran732/synapse
|
||||||
docker push ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c6)
|
docker push ghcr.io/tommytran732/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c6)
|
||||||
docker push ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c4)
|
docker push ghcr.io/tommytran732/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c4)
|
|
@ -1,14 +1,14 @@
|
||||||
name: scan
|
name: Scan
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# Scan the image regularly (once a day)
|
# Scan the image regularly (once a day)
|
||||||
- cron: '45 03 * * *'
|
- cron: '0 23 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
scan:
|
||||||
name: Scan current image & report results
|
name: Scan current image & report results
|
||||||
runs-on: "ubuntu-20.04"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -16,7 +16,7 @@ jobs:
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'ghcr.io/wonderfall/synapse'
|
image-ref: 'ghcr.io/tommytran732/synapse'
|
||||||
format: 'template'
|
format: 'template'
|
||||||
template: '@/contrib/sarif.tpl'
|
template: '@/contrib/sarif.tpl'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
21
Dockerfile
21
Dockerfile
|
@ -1,17 +1,15 @@
|
||||||
ARG SYNAPSE_VERSION=1.66.0
|
ARG SYNAPSE_VERSION=1.66.0
|
||||||
ARG PYTHON_VERSION=3.10
|
|
||||||
ARG ALPINE_VERSION=3.16
|
|
||||||
ARG HARDENED_MALLOC_VERSION=11
|
ARG HARDENED_MALLOC_VERSION=11
|
||||||
ARG UID=991
|
ARG UID=991
|
||||||
ARG GID=991
|
ARG GID=991
|
||||||
|
|
||||||
|
|
||||||
### Build Hardened Malloc
|
### Build Hardened Malloc
|
||||||
FROM alpine:${ALPINE_VERSION} as build-malloc
|
FROM alpine:latest as build-malloc
|
||||||
|
|
||||||
ARG HARDENED_MALLOC_VERSION
|
ARG HARDENED_MALLOC_VERSION
|
||||||
ARG CONFIG_NATIVE=false
|
ARG CONFIG_NATIVE=false
|
||||||
ARG VARIANT=light
|
ARG VARIANT=default
|
||||||
|
|
||||||
RUN apk --no-cache add build-base git gnupg && cd /tmp \
|
RUN apk --no-cache add build-base git gnupg && cd /tmp \
|
||||||
&& wget -q https://github.com/thestinger.gpg && gpg --import thestinger.gpg \
|
&& wget -q https://github.com/thestinger.gpg && gpg --import thestinger.gpg \
|
||||||
|
@ -21,8 +19,7 @@ RUN apk --no-cache add build-base git gnupg && cd /tmp \
|
||||||
|
|
||||||
|
|
||||||
### Build Synapse
|
### Build Synapse
|
||||||
ARG ALPINE_VERSION
|
FROM python:alpine as builder
|
||||||
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} as builder
|
|
||||||
|
|
||||||
ARG SYNAPSE_VERSION
|
ARG SYNAPSE_VERSION
|
||||||
|
|
||||||
|
@ -38,15 +35,14 @@ RUN apk -U upgrade \
|
||||||
rustup \
|
rustup \
|
||||||
zlib-dev \
|
zlib-dev \
|
||||||
&& rustup-init -y && source $HOME/.cargo/env \
|
&& rustup-init -y && source $HOME/.cargo/env \
|
||||||
|
&& pip install --upgrade pip \
|
||||||
&& pip install --prefix="/install" --no-warn-script-location \
|
&& pip install --prefix="/install" --no-warn-script-location \
|
||||||
matrix-synapse[all]==${SYNAPSE_VERSION}
|
matrix-synapse[all]==${SYNAPSE_VERSION}
|
||||||
|
|
||||||
|
|
||||||
### Build Production
|
### Build Production
|
||||||
ARG ALPINE_VERSION
|
|
||||||
ARG PYTHON_VERSION
|
|
||||||
|
|
||||||
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}
|
FROM python:alpine
|
||||||
|
|
||||||
ARG UID
|
ARG UID
|
||||||
ARG GID
|
ARG GID
|
||||||
|
@ -63,15 +59,18 @@ RUN apk -U upgrade \
|
||||||
zlib \
|
zlib \
|
||||||
tzdata \
|
tzdata \
|
||||||
xmlsec \
|
xmlsec \
|
||||||
|
git \
|
||||||
&& adduser -g ${GID} -u ${UID} --disabled-password --gecos "" synapse \
|
&& adduser -g ${GID} -u ${UID} --disabled-password --gecos "" synapse \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip \
|
||||||
|
&& pip install -e "git+https://github.com/matrix-org/mjolnir.git#egg=mjolnir&subdirectory=synapse_antispam"
|
||||||
|
|
||||||
COPY --from=build-malloc /tmp/hardened_malloc/out-light/libhardened_malloc-light.so /usr/local/lib/
|
COPY --from=build-malloc /tmp/hardened_malloc/out/libhardened_malloc.so /usr/local/lib/
|
||||||
COPY --from=builder /install /usr/local
|
COPY --from=builder /install /usr/local
|
||||||
COPY --chown=synapse:synapse rootfs /
|
COPY --chown=synapse:synapse rootfs /
|
||||||
|
|
||||||
ENV LD_PRELOAD="/usr/local/lib/libhardened_malloc-light.so"
|
ENV LD_PRELOAD="/usr/local/lib/libhardened_malloc.so"
|
||||||
|
|
||||||
USER synapse
|
USER synapse
|
||||||
|
|
||||||
|
|
11
README.md
11
README.md
|
@ -1,17 +1,20 @@
|
||||||
# wonderfall/synapse
|
# tommytran732/synapse
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[Synapse](https://github.com/matrix-org/synapse) is a [Matrix](https://matrix.org/) implementation written in Python.
|
[Synapse](https://github.com/matrix-org/synapse) is a [Matrix](https://matrix.org/) implementation written in Python.
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
- Prebuilt images are available at `ghcr.io/wonderfall/synapse`.
|
- Prebuilt images are available at `ghcr.io/tommytran732/synapse`.
|
||||||
- Don't trust random images: build yourself if you can.
|
- Don't trust random images: build yourself if you can.
|
||||||
- Always keep your software up-to-date: manage versions with [build-time variables](https://github.com/Wonderfall/docker-synapse/blob/main/Dockerfile#L1-L6).
|
- Always keep your software up-to-date: manage versions with [build-time variables](https://github.com/TommyTran732/Synapse-Docker/blob/main/Dockerfile#L1-L4).
|
||||||
- Images from `ghcr.io` are built every week, and scanned every day for critical vulnerabilities.
|
- Images from `ghcr.io` are built every week, and scanned every day for critical vulnerabilities with Trivy.
|
||||||
|
|
||||||
### Features & usage
|
### Features & usage
|
||||||
- Drop-in replacement for the [official image](https://github.com/matrix-org/synapse/tree/develop/docker).
|
- Drop-in replacement for the [official image](https://github.com/matrix-org/synapse/tree/develop/docker).
|
||||||
- Unprivileged image: you should check your volumes permissions (eg `/data`), default UID/GID is 991.
|
- Unprivileged image: you should check your volumes permissions (eg `/data`), default UID/GID is 991.
|
||||||
- Based on [Alpine](https://alpinelinux.org/), which provides more recent packages while having less attack surface.
|
- Based on [Alpine](https://alpinelinux.org/), which provides more recent packages while having less attack surface.
|
||||||
- Comes with a [hardened memory allocator](https://github.com/GrapheneOS/hardened_malloc), protecting against some heap-based buffer overflows.
|
- Comes with a [hardened memory allocator](https://github.com/GrapheneOS/hardened_malloc), protecting against some heap-based buffer overflows.
|
||||||
|
- [Mjolnir module](https://github.com/matrix-org/mjolnir/blob/main/docs/synapse_module.md) support.
|
Loading…
Add table
Add a link
Reference in a new issue