diff --git a/.gitea/workflows/container.yaml b/.gitea/workflows/container.yaml new file mode 100644 index 0000000..e48b3fd --- /dev/null +++ b/.gitea/workflows/container.yaml @@ -0,0 +1,12 @@ +name: Build Multiarch Container Image +on: [push] +jobs: + call-reusable-workflow: + uses: container/multiarch-build-workflow/.gitea/workflows/build.yaml@main + with: + repository: ${{ gitea.repository }} + ref_name: ${{ gitea.ref_name }} + sha: ${{ gitea.sha }} + registry_url: ${{ secrets.REGISTRY_URL }} + registry_user: ${{ secrets.REGISTRY_USER }} + registry_pw: ${{ secrets.REGISTRY_PW }} diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index b4844fc..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,11 +0,0 @@ -pipeline: - publish-docker-image: - image: plugins/kaniko - settings: - repo: docker.io/thallian/matrix-appservice-telegram - tags: latest,${CI_COMMIT_SHA:0:8},${CI_COMMIT_TAG=pre} - dockerfile: Dockerfile - username: - from_secret: DOCKER_USER - password: - from_secret: DOCKER_PW \ No newline at end of file diff --git a/Dockerfile b/Containerfile similarity index 75% rename from Dockerfile rename to Containerfile index a8e91c9..5b19794 100644 --- a/Dockerfile +++ b/Containerfile @@ -1,10 +1,9 @@ -FROM docker.io/alpine:3.16 as builder +FROM docker.io/alpine:3.19 as builder -ENV VERSION=5558fc7157361e3c7f721fc7c82a1d5a084a96de RUN apk --no-cache add \ sed \ - gcc \ + gcc \ g++ \ git \ musl-dev \ @@ -12,8 +11,51 @@ RUN apk --no-cache add \ python3-dev \ rust \ cargo \ - py3-pip \ + py3-pip \ py3-wheel \ + py3-olm \ + py3-qrcode \ + py3-pillow \ + py3-unpaddedbase64 \ + py3-pycryptodome \ + py3-pyaes \ + py3-rsa \ + py3-cparser \ + py3-cffi \ + py3-decorator \ + py3-tqdm \ + py3-numpy \ + py3-future \ + py3-asn1 \ + py3-magic \ + py3-commonmark \ + py3-yarl \ + py3-mako + +ENV VERSION=v0.15.1 + +RUN git clone https://github.com/mautrix/telegram.git +WORKDIR /telegram +RUN git checkout "$VERSION" +RUN pip3 install --prefix=/install --upgrade -r requirements.txt +RUN pip3 install --prefix=/install --upgrade -r optional-requirements.txt +RUN cp -r mautrix_telegram /install/lib/python3.11/site-packages/ + + +FROM docker.io/thallian/confd-env:3.19-3.1.6.2 + +ENV FFMPEG_BINARY=/usr/bin/ffmpeg + +COPY --from=builder /install /py-pkgs + +RUN addgroup -g 2222 matrix-bridge +RUN adduser -h /var/lib/matrix-bridge -u 2222 -D -G matrix-bridge matrix-bridge + +RUN apk --no-cache add \ + ca-certificates \ + ffmpeg \ + libffi \ + python3 \ py3-brotli \ py3-olm \ py3-qrcode \ @@ -38,53 +80,7 @@ RUN apk --no-cache add \ py3-mako \ py3-setuptools -RUN git clone https://github.com/mautrix/telegram.git -WORKDIR /telegram -RUN git checkout "$VERSION" -RUN pip3 install --prefix=/install --upgrade -r requirements.txt -RUN pip3 install --prefix=/install --upgrade -r optional-requirements.txt -RUN cp -r mautrix_telegram /install/lib/python3.10/site-packages/ - - -FROM docker.io/thallian/confd-env:3.16 - -ENV FFMPEG_BINARY=/usr/bin/ffmpeg - -COPY --from=builder /install /py-pkgs - -RUN addgroup -g 2222 matrix-bridge -RUN adduser -h /var/lib/matrix-bridge -u 2222 -D -G matrix-bridge matrix-bridge - -RUN apk --no-cache add \ - ca-certificates \ - ffmpeg \ - libffi \ - python3 \ - py3-brotli \ - py3-olm \ - py3-qrcode \ - py3-pillow \ - py3-phonenumbers \ - py3-unpaddedbase64 \ - py3-pycryptodome \ - py3-pyaes \ - py3-rsa \ - py3-cparser \ - py3-cffi \ - py3-decorator \ - py3-tqdm \ - py3-numpy \ - py3-future \ - py3-asn1 \ - py3-ruamel.yaml \ - py3-magic \ - py3-commonmark \ - py3-aiohttp \ - py3-yarl \ - py3-mako \ - py3-setuptools - -ENV PYTHONPATH=/usr/lib/python3.10/site-packages:/py-pkgs/lib/python3.10/site-packages/ +ENV PYTHONPATH=/usr/lib/python3.11/site-packages:/py-pkgs/lib/python3.11/site-packages/ WORKDIR /var/lib/matrix-bridge diff --git a/rootfs/etc/confd/templates/config.yaml.tmpl b/rootfs/etc/confd/templates/config.yaml.tmpl index e69dc1a..c86ba0e 100644 --- a/rootfs/etc/confd/templates/config.yaml.tmpl +++ b/rootfs/etc/confd/templates/config.yaml.tmpl @@ -26,13 +26,13 @@ homeserver: # Changing these values requires regeneration of the registration. appservice: # The address that the homeserver can use to connect to this appservice. - address: http://localhost:29317 + address: http://{{getenv "HOSTNAME"}}:29317 # When using https:// the TLS certificate and key files for the address. tls_cert: false tls_key: false # The hostname and port where this appservice should listen. - hostname: :: + hostname: [::] port: 29317 # The maximum body size of appservice API requests (from the homeserver) in mebibytes # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s @@ -270,7 +270,7 @@ bridge: require: false # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled. # You must use a client that supports requesting keys from other users to use this feature. - allow_key_sharing: false + allow_key_sharing: true # What level of device verification should be required from users? # # Valid levels: