diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cc02ccf..f3cfb3c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -77,7 +77,7 @@ jobs: run: sudo apt-get install libolm-dev libolm3 gobjc++-mingw-w64 - name: Build - run: go build + run: bash ./build.sh - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/Dockerfile.ci b/Dockerfile.ci index e17ebcc..46e5afe 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1,14 +1,29 @@ -FROM alpine:3.19 +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest -ENV UID=1337 \ - GID=1337 +ENV UID=1000 \ + GID=1000 -RUN apk add --no-cache ffmpeg su-exec ca-certificates bash jq curl yq olm +RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + +# Install dependencies using microdnf +RUN microdnf install -y \ + shadow-utils \ + ca-certificates \ + bash \ + jq \ + libolm \ + && microdnf clean all + +RUN curl -sSL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && chmod +x /usr/bin/yq ARG EXECUTABLE=./mautrix-imessage COPY $EXECUTABLE /usr/bin/mautrix-imessage COPY ./example-config.yaml /opt/mautrix-imessage/example-config.yaml COPY ./docker-run.sh /docker-run.sh + +# Ensure the entrypoint script is executable +RUN chmod +x /docker-run.sh /usr/bin/mautrix-imessage + VOLUME /data CMD ["/docker-run.sh"] diff --git a/build.sh b/build.sh index 1dab651..42892ad 100755 --- a/build.sh +++ b/build.sh @@ -14,4 +14,4 @@ if [[ -f "$HEIF_PATH/libheif.1.dylib" ]]; then build_tags="libheif" fi -go build -tags "$build_tags" -ldflags "-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'`'" "$@" +go build -o mautrix-imessage -tags "$build_tags" -ldflags "-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'`'" "$@" diff --git a/docker-run.sh b/docker-run.sh index da0b7b7..733743d 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -4,16 +4,6 @@ if [[ -z "$GID" ]]; then GID="$UID" fi -# Define functions. -function fixperms { - chown -R $UID:$GID /data - - # /opt/mautrix-imessage is read-only, so disable file logging if it's pointing there. - if [[ "$(yq e '.logging.writers[1].filename' /data/config.yaml)" == "./logs/mautrix-imessage.log" ]]; then - yq -I4 e -i 'del(.logging.writers[1])' /data/config.yaml - fi -} - if [[ ! -f /data/config.yaml ]]; then cp /opt/mautrix-imessage/example-config.yaml /data/config.yaml echo "Didn't find a config file." @@ -32,5 +22,7 @@ if [[ ! -f /data/registration.yaml ]]; then fi cd /data -fixperms -exec su-exec $UID:$GID /usr/bin/mautrix-imessage + +chown -R $UID:$GID /data +#exec su-exec $UID:$GID /usr/bin/mautrix-imessage +exec /usr/bin/mautrix-imessage