mirror of
https://github.com/mautrix/telegram.git
synced 2026-05-16 23:15:45 +03:00
ci: remove unnecessary files and align with what mautrix-slack has
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -1,21 +0,0 @@
|
|||||||
FROM golang:1-alpine3.19 AS builder
|
|
||||||
|
|
||||||
RUN apk add --no-cache git ca-certificates build-base su-exec olm-dev
|
|
||||||
|
|
||||||
COPY . /build
|
|
||||||
WORKDIR /build
|
|
||||||
RUN go build -o /usr/bin/mautrix-telegram
|
|
||||||
|
|
||||||
FROM alpine:3.19
|
|
||||||
|
|
||||||
ENV UID=1337 \
|
|
||||||
GID=1337
|
|
||||||
|
|
||||||
RUN apk add --no-cache ffmpeg su-exec ca-certificates olm bash jq yq curl
|
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/mautrix-telegram /usr/bin/mautrix-telegram
|
|
||||||
COPY --from=builder /build/example-config.yaml /opt/mautrix-telegram/example-config.yaml
|
|
||||||
COPY --from=builder /build/docker-run.sh /docker-run.sh
|
|
||||||
VOLUME /data
|
|
||||||
|
|
||||||
CMD ["/docker-run.sh"]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
FROM alpine:3.19
|
|
||||||
|
|
||||||
ENV UID=1337 \
|
|
||||||
GID=1337
|
|
||||||
|
|
||||||
RUN apk add --no-cache ffmpeg su-exec ca-certificates bash jq curl yq
|
|
||||||
|
|
||||||
ARG EXECUTABLE=./mautrix-telegram
|
|
||||||
COPY $EXECUTABLE /usr/bin/mautrix-telegram
|
|
||||||
COPY ./example-config.yaml /opt/mautrix-telegram/example-config.yaml
|
|
||||||
COPY ./docker-run.sh /docker-run.sh
|
|
||||||
VOLUME /data
|
|
||||||
|
|
||||||
CMD ["/docker-run.sh"]
|
|
||||||
6
build.sh
6
build.sh
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export MAUTRIX_VERSION=$(cat go.mod | grep 'maunium.net/go/mautrix ' | awk '{ print $2 }')
|
MAUTRIX_VERSION=$(cat go.mod | grep 'maunium.net/go/mautrix ' | awk '{ print $2 }' | head -n1)
|
||||||
export GO_LDFLAGS="-s -w -X main.Tag=$(git describe --exact-match --tags 2>/dev/null) -X main.Commit=$(git rev-parse HEAD) -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`' -X 'maunium.net/go/mautrix.GoModVersion=$MAUTRIX_VERSION'"
|
GO_LDFLAGS="-s -w -X main.Tag=$(git describe --exact-match --tags 2>/dev/null) -X main.Commit=$(git rev-parse HEAD) -X 'main.BuildTime=`date -Iseconds`' -X 'maunium.net/go/mautrix.GoModVersion=$MAUTRIX_VERSION'"
|
||||||
go build -ldflags "$GO_LDFLAGS" -o mautrix-telegram "$@"
|
go build -ldflags="$GO_LDFLAGS" ./cmd/mautrix-telegram "$@"
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ if [[ -z "$GID" ]]; then
|
|||||||
GID="$UID"
|
GID="$UID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define functions.
|
BINARY_NAME=/usr/bin/mautrix-telegram
|
||||||
|
|
||||||
function fixperms {
|
function fixperms {
|
||||||
chown -R $UID:$GID /data
|
chown -R $UID:$GID /data
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ function fixperms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -f /data/config.yaml ]]; then
|
if [[ ! -f /data/config.yaml ]]; then
|
||||||
cp /opt/mautrix-telegram/example-config.yaml /data/config.yaml
|
$BINARY_NAME -c /data/config.yaml -e
|
||||||
echo "Didn't find a config file."
|
echo "Didn't find a config file."
|
||||||
echo "Copied default config file to /data/config.yaml"
|
echo "Copied default config file to /data/config.yaml"
|
||||||
echo "Modify that config file to your liking."
|
echo "Modify that config file to your liking."
|
||||||
@@ -24,7 +25,7 @@ if [[ ! -f /data/config.yaml ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f /data/registration.yaml ]]; then
|
if [[ ! -f /data/registration.yaml ]]; then
|
||||||
/usr/bin/mautrix-telegram -g -c /data/config.yaml -r /data/registration.yaml || exit $?
|
$BINARY_NAME -g -c /data/config.yaml -r /data/registration.yaml
|
||||||
echo "Didn't find a registration file."
|
echo "Didn't find a registration file."
|
||||||
echo "Generated one for you."
|
echo "Generated one for you."
|
||||||
echo "See https://docs.mau.fi/bridges/general/registering-appservices.html on how to use it."
|
echo "See https://docs.mau.fi/bridges/general/registering-appservices.html on how to use it."
|
||||||
@@ -33,4 +34,4 @@ fi
|
|||||||
|
|
||||||
cd /data
|
cd /data
|
||||||
fixperms
|
fixperms
|
||||||
exec su-exec $UID:$GID /usr/bin/mautrix-telegram
|
exec su-exec $UID:$GID $BINARY_NAME
|
||||||
|
|||||||
Reference in New Issue
Block a user