diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1ec7bb..3d2d37e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,8 @@ concurrency: on: workflow_dispatch: + schedule: + - cron: '0 0 * * 1' # every Monday at midnight push: branches: - main diff --git a/Dockerfile b/Dockerfile index 9d0b0ab..b61c732 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,18 @@ -FROM docker.io/minio/minio:RELEASE.2023-12-14T18-51-57Z +ARG builder_version=8.9 +ARG runner_version=8.9 -ENV MINIO_USER minio -ENV MINIO_UID_GID 5001 +FROM registry.access.redhat.com/ubi8/ubi:${builder_version} AS builder +ARG ref=master +RUN dnf install -y go git make gettext \ + && pushd /root \ + && git clone --depth 1 --branch $ref https://github.com/seaweedfs/seaweedfs \ + && pushd seaweedfs/weed \ + && make install \ + && popd \ + && popd -RUN echo "${MINIO_USER}:x:${MINIO_UID_GID}:${MINIO_UID_GID}:${MINIO_USER}:/home/${MINIO_USER}:/sbin/nologin" >> /etc/passwd && \ - echo "${MINIO_USER}:x:${MINIO_UID_GID}:" >> /etc/group && \ - mkdir "/home/${MINIO_USER}" - -USER 5001 +FROM registry.access.redhat.com/ubi8/ubi-micro:${runner_version} +COPY --from=builder /usr/bin/envsubst /root/go/bin/weed /root/seaweedfs/docker/entrypoint.sh /usr/bin/ +COPY ./cryostat-entrypoint.bash /usr/bin/ +COPY seaweed_conf.template.json /etc/seaweed_conf.template.json +ENTRYPOINT ["/usr/bin/cryostat-entrypoint.bash"] diff --git a/README.md b/README.md index a149076..70aa73e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Image Repository on Quay](https://quay.io/repository/cryostat/cryostat-storage/status "Image Repository on Quay")](https://quay.io/repository/cryostat/cryostat-storage) [![Google Group : Cryostat Development](https://img.shields.io/badge/Google%20Group-Cryostat%20Development-blue.svg)](https://groups.google.com/g/cryostat-development) -This is a lightly customized [Minio](https://github.com/minio/minio) storage image for use by [cryostat](https://github.com/cryostatio/cryostat3). +This is a lightly customized [SeaweedFS](https://github.com/seaweedfs/seaweedfs) storage image for use by [cryostat](https://github.com/cryostatio/cryostat3). ## CONTRIBUTING diff --git a/cryostat-entrypoint.bash b/cryostat-entrypoint.bash new file mode 100755 index 0000000..68ef82c --- /dev/null +++ b/cryostat-entrypoint.bash @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if [ -z "${CRYOSTAT_ACCESS_KEY}" ]; then + echo 'CRYOSTAT_ACCESS_KEY must be set and non-empty' + exit 1 +fi + +if [ -z "${CRYOSTAT_SECRET_KEY}" ]; then + echo 'CRYOSTAT_SECRET_KEY must be set and non-empty' + exit 2 +fi + +set -xe + +cfg="$(mktemp)" +envsubst '$CRYOSTAT_ACCESS_KEY $CRYOSTAT_SECRET_KEY' < /etc/seaweed_conf.template.json > "${cfg}" + +exec /usr/bin/entrypoint.sh \ + server -dir="${DATA_DIR:-/tmp}" \ + -s3 -s3.config="${cfg}" \ + "$@" diff --git a/seaweed_conf.template.json b/seaweed_conf.template.json new file mode 100644 index 0000000..866eceb --- /dev/null +++ b/seaweed_conf.template.json @@ -0,0 +1,28 @@ +{ + "identities": [ + { + "name": "anonymous", + "actions": [ + "Read" + ] + }, + { + "name": "cryostat", + "credentials": [ + { + "accessKey": "$CRYOSTAT_ACCESS_KEY", + "secretKey": "$CRYOSTAT_SECRET_KEY" + } + ], + "actions": [ + "Admin", + "Read", + "ReadAcp", + "List", + "Tagging", + "Write", + "WriteAcp" + ] + } + ] +}