forked from 42wim/matterbridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM alpine AS builder | ||
|
||
COPY . /go/src/matterbridge | ||
RUN apk --no-cache add go git \ | ||
&& cd /go/src/matterbridge \ | ||
&& CGO_ENABLED=0 go build -tags whatsappmulti,nomsteams,nozulip -mod vendor -ldflags "-X github.com/42wim/matterbridge/version.GitHash=$(git log --pretty=format:'%h' -n 1)" -o /bin/matterbridge | ||
|
||
FROM alpine | ||
RUN apk --no-cache add ca-certificates mailcap aws-cli openssl | ||
|
||
RUN mkdir /etc/matterbridge | ||
WORKDIR /etc/matterbridge | ||
|
||
COPY --from=builder /bin/matterbridge /etc/matterbridge/ | ||
COPY --from=builder /go/src/matterbridge/run.sh /etc/matterbridge/ | ||
|
||
ENTRYPOINT [ "sh", "run.sh" ] | ||
CMD ["/etc/matterbridge/matterbridge"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# | ||
# Matterbridge runtime | ||
# | ||
# set -x | ||
# Environment variables: | ||
# phoneNumber e.g 972505152183 | ||
# userStorage e.g. s3://us-west-2-guardian-data154316-dev/private/us-west-2:6da317cd-7edd-472d-8d3c-6aee1296ac3c/phone-data/${phoneNumber}/ | ||
|
||
# files | ||
phoneNumber="972525583454" | ||
CONF_FILE="matterbridge.toml" | ||
SESSION_FILE="session+${phoneNumber}.gob.db" | ||
FILE_DESTINATION="/etc/matterbridge/" | ||
userStorage="s3://us-west-2-guardian-data154316-dev/private/us-west-2:6da317cd-7edd-472d-8d3c-6aee1296ac3c/phone-data/${phoneNumber}" | ||
|
||
# download from S3 | ||
donwload_from_s3() { | ||
echo "Downloading $1 to ${userStorage}" | ||
aws s3 cp --profile c $userStorage/$1 $FILE_DESTINATION/$1 | ||
} | ||
|
||
# environment debug | ||
echo "working on phoneNumber: $phoneNumber" | ||
echo "bucket: $userStorage" | ||
echo "session file: ${SESSION_FILE}" | ||
|
||
# Download config, and session db file from s3 userStorage | ||
donwload_from_s3 ${CONF_FILE} | ||
download_from_s3 ${SESSION_FILE} | ||
|
||
echo "Starting matterbrigde" | ||
# /etc/matterbridge/matterbridge | ||
exec "$@" | ||
|