1
0
mirror of https://github.com/tommytran732/Matrix.to-Docker synced 2024-11-25 11:11:34 -05:00

Reach parity with TommyTran732/Synapse-Docker

Signed-off-by: Tommy <contact@tommytran.io>
This commit is contained in:
Tommy 2024-05-30 11:40:27 -07:00
parent fb7ad7854d
commit 37eb92672d
Signed by: Tomster
GPG Key ID: 555C902A34EC968F
3 changed files with 83 additions and 10 deletions

View File

@ -27,18 +27,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@main
uses: sigstore/cosign-installer@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
@ -46,7 +46,7 @@ jobs:
- name: Set Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@ -67,3 +67,23 @@ jobs:
env:
COSIGN_EXPERIMENTAL: "true"
TAGS: ${{ steps.meta.outputs.tags }}
scan:
name: Scan current image & report results
needs: build
runs-on: "ubuntu-latest"
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/tommytran732/matrix.to'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
vuln-type: "os"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'

27
.github/workflows/scan.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Scan
on:
workflow_dispatch:
schedule:
# Scan the image regularly (once a day)
- cron: '0 23 * * *'
jobs:
scan:
name: Scan current image & report results
runs-on: "ubuntu-latest"
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/tommytran732/matrix.to'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
vuln-type: "os"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'

View File

@ -1,3 +1,25 @@
ARG HARDENED_MALLOC_VERSION=2024052100
### Build Hardened Malloc
FROM alpine:latest as hmalloc-builder
ARG HARDENED_MALLOC_VERSION
ARG CONFIG_NATIVE=false
ARG VARIANT=default
RUN apk -U upgrade \
&& apk --no-cache add build-base git gnupg openssh-keygen
RUN cd /tmp \
&& git clone --depth 1 --branch ${HARDENED_MALLOC_VERSION} https://github.com/GrapheneOS/hardened_malloc \
&& cd hardened_malloc \
&& wget -q https://grapheneos.org/allowed_signers -O grapheneos_allowed_signers \
&& git config gpg.ssh.allowedSignersFile grapheneos_allowed_signers \
&& git verify-tag $(git describe --tags) \
&& make CONFIG_NATIVE=${CONFIG_NATIVE} VARIANT=${VARIANT}
### Build Production
FROM node:alpine
LABEL maintainer="Thien Tran contact@tommytran.io"
@ -6,8 +28,8 @@ ARG UID=992
ARG GID=992
RUN apk -U upgrade \
&& apk --no-cache add git \
&& adduser -g ${GID} -u ${UID} --disabled-password --gecos "" matrix-to
&& apk --no-cache add git \
&& adduser -g ${GID} -u ${UID} --disabled-password --gecos "" matrix-to
USER matrix-to
@ -20,9 +42,13 @@ COPY element.patch /home/matrix-to/matrix.to
WORKDIR /home/matrix-to/matrix.to
RUN git apply /home/matrix-to/matrix.to/element.patch \
&& rm -rf .git \
&& yarn \
&& yarn build
&& rm -rf .git \
&& yarn \
&& yarn build
COPY --from=hmalloc-builder /tmp/hardened_malloc/out/libhardened_malloc.so /usr/local/lib/
ENV LD_PRELOAD="/usr/local/lib/libhardened_malloc.so"
EXPOSE 5000