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:
parent
fb7ad7854d
commit
37eb92672d
30
.github/workflows/build.yml
vendored
30
.github/workflows/build.yml
vendored
@ -27,18 +27,18 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: sigstore/cosign-installer@main
|
uses: sigstore/cosign-installer@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to registry
|
- name: Login to registry
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@ -46,7 +46,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Set Docker metadata
|
- name: Set Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
tags: |
|
tags: |
|
||||||
@ -67,3 +67,23 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
COSIGN_EXPERIMENTAL: "true"
|
COSIGN_EXPERIMENTAL: "true"
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
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
27
.github/workflows/scan.yml
vendored
Normal 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'
|
26
Dockerfile
26
Dockerfile
@ -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
|
FROM node:alpine
|
||||||
|
|
||||||
LABEL maintainer="Thien Tran contact@tommytran.io"
|
LABEL maintainer="Thien Tran contact@tommytran.io"
|
||||||
@ -24,6 +46,10 @@ RUN git apply /home/matrix-to/matrix.to/element.patch \
|
|||||||
&& yarn \
|
&& yarn \
|
||||||
&& yarn build
|
&& 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
|
EXPOSE 5000
|
||||||
|
|
||||||
ENTRYPOINT ["yarn", "start"]
|
ENTRYPOINT ["yarn", "start"]
|
||||||
|
Loading…
Reference in New Issue
Block a user