Skip to content

Commit

Permalink
Use ubi image
Browse files Browse the repository at this point in the history
  • Loading branch information
jantomgid committed Jul 12, 2024
1 parent 46ac0e2 commit dd9068a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'`'" "$@"
16 changes: 4 additions & 12 deletions docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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

0 comments on commit dd9068a

Please sign in to comment.