Skip to content

Commit

Permalink
ci: build binaries and docker images for v2 (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jun 13, 2024
1 parent 6964a0d commit 84999d4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
include:
- project: 'mautrix/ci'
file: '/go.yml'
- project: 'mautrix/ci'
file: '/gov2.yml'

variables:
BUILDER_IMAGE: dock.mau.dev/tulir/gomuks-build-docker/signal
BINARY_NAME: mautrix-signal

# 32-bit arm builds aren't supported
build arm:
rules:
- when: never

build arm v2:
rules:
- when: never
15 changes: 15 additions & 0 deletions Dockerfile.v2.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3.20

ENV UID=1337 \
GID=1337

RUN apk add --no-cache ffmpeg su-exec ca-certificates bash jq curl yq-go

ARG EXECUTABLE=./mautrix-signal-v2
COPY $EXECUTABLE /usr/bin/mautrix-signal-v2
COPY ./docker-run.sh /docker-run.sh
ENV BRIDGEV2=1
VOLUME /data
WORKDIR /data

CMD ["/docker-run.sh"]
18 changes: 13 additions & 5 deletions docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ if [[ -z "$GID" ]]; then
GID="$UID"
fi

BINARY_NAME=/usr/bin/mautrix-signal
if [[ "$BRIDGEV2" == "1" ]]; then
BINARY_NAME=/usr/bin/mautrix-signal-v2
fi

# Define functions.
function fixperms {
chown -R $UID:$GID /data
Expand All @@ -15,7 +20,11 @@ function fixperms {
}

if [[ ! -f /data/config.yaml ]]; then
cp /opt/mautrix-signal/example-config.yaml /data/config.yaml
if [[ "$BRIDGEV2" == "1" ]]; then
$BINARY_NAME -c /data/config -e
else
cp /opt/mautrix-signal/example-config.yaml /data/config.yaml
fi
echo "Didn't find a config file."
echo "Copied default config file to /data/config.yaml"
echo "Modify that config file to your liking."
Expand All @@ -24,7 +33,7 @@ if [[ ! -f /data/config.yaml ]]; then
fi

if [[ ! -f /data/registration.yaml ]]; then
/usr/bin/mautrix-signal -g -c /data/config.yaml -r /data/registration.yaml || exit $?
$BINARY_NAME -g -c /data/config.yaml -r /data/registration.yaml || exit $?
echo "Didn't find a registration file."
echo "Generated one for you."
echo "See https://docs.mau.fi/bridges/general/registering-appservices.html on how to use it."
Expand All @@ -34,13 +43,12 @@ fi
cd /data
fixperms

EXE=/usr/bin/mautrix-signal
DLV=/usr/bin/dlv
if [ -x "$DLV" ]; then
if [ "$DBGWAIT" != 1 ]; then
NOWAIT=1
fi
EXE="${DLV} exec ${EXE} ${NOWAIT:+--continue --accept-multiclient} --api-version 2 --headless -l :4040"
BINARY_NAME="${DLV} exec ${BINARY_NAME} ${NOWAIT:+--continue --accept-multiclient} --api-version 2 --headless -l :4040"
fi

exec su-exec $UID:$GID $EXE
exec su-exec $UID:$GID $BINARY_NAME

0 comments on commit 84999d4

Please sign in to comment.