From 9a9c612951961eb33385653b0c0f624a894f9766 Mon Sep 17 00:00:00 2001 From: en Date: Wed, 5 Mar 2025 17:56:45 +0000 Subject: [PATCH] update Dockerfile --- .gitea/workflows/package.yml | 26 +++++++++++++++++++++ CloudronManifest.json | 36 +++++++++++++---------------- Dockerfile | 45 +++++++++++++++++++++++++++++------- 3 files changed, 79 insertions(+), 28 deletions(-) create mode 100644 .gitea/workflows/package.yml diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml new file mode 100644 index 0000000..f787bc8 --- /dev/null +++ b/.gitea/workflows/package.yml @@ -0,0 +1,26 @@ +name: Release to Gitea Container Registry +on: + push: + branches: + - main + +jobs: + build_and_push: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Log in to local registry + uses: docker/login-action@v3 + with: + registry: git.nostrdev.com + username: ${{ gitea.repository_owner }} + password: ${{ secrets.REGISTRY_TOKEN }} # gitea.token doesn't work for push, provide a personal access token + + - name: Build Docker image + run: docker build --no-cache -t git.nostrdev.com/stuff/strfry-cloudron . + + - name: Push Docker image + run: docker push git.nostrdev.com/stuff/strfry-cloudron diff --git a/CloudronManifest.json b/CloudronManifest.json index cb3ad61..cd7c85a 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -1,22 +1,18 @@ { - "id": "com.hoytech.strfry", - "title": "strfry", - "author": "hoytech", - "tagline": "a nostr relay", - "version": "0.9.6", - "healthCheckPath": "/", - "httpPort": 7777, - "addons": { - "localstorage": {} - }, - "manifestVersion": 2, - "website": "https://github.com/hoytech/strfry", - "contactEmail": "seb@sebdev.io", - "icon": "logo.png", - "tags": [ - "nostr", - "relay" - ], - "postInstallMessage": "file://POSTINSTALL.md", - "description": "file://DESCRIPTION.md" + "id": "com.nostrdev.strfry", + "title": "strfry", + "author": "hoytech", + "tagline": "A nostr relay", + "version": "1.0.4", + "healthCheckPath": "/", + "httpPort": 7777, + "addons": { + "localstorage": {} + }, + "manifestVersion": 2, + "website": "https://git.nostrdev.com/stuff/strfry-cloudron", + "icon": "logo.png", + "tags": ["nostr", "relay"], + "postInstallMessage": "file://POSTINSTALL.md", + "description": "file://DESCRIPTION.md" } diff --git a/Dockerfile b/Dockerfile index d2f4099..881ee31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,52 @@ -FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4 +FROM cloudron/base:5.0.0@sha256:04fd70dbd8ad6149c19de39e35718e024417c3e01dc9c6637eaf4a41ec4e596c AS base +FROM base AS chief +WORKDIR /usr/src/app + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | /bin/bash -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +RUN git clone https://github.com/0xtrr/chief.git +RUN cd chief && cargo build --release + +FROM base AS strfry +WORKDIR /build + +RUN apt update && apt install -y --no-install-recommends \ + git g++ make pkg-config libtool ca-certificates \ + libyaml-perl libtemplate-perl libregexp-grammars-perl libssl-dev zlib1g-dev \ + liblmdb-dev libflatbuffers-dev libsecp256k1-dev \ + libzstd-dev + + ARG STRFRY_VERSION=1.0.4 +RUN git clone --branch ${STRFRY_VERSION} https://github.com/hoytech/strfry.git + +WORKDIR /build/strfry +RUN git submodule update --init +RUN make setup-golpe +RUN make clean +RUN make -j4 + +FROM base AS cloudron RUN apt update && apt install -y --no-install-recommends \ liblmdb0 libflatbuffers1 libsecp256k1-0 libb2-1 libzstd1 \ && rm -rf /var/lib/apt/lists/* - RUN mkdir -p /app/code /app/pkg WORKDIR /app/code -ARG STRFRY_VERSION=v0.9.6 -ARG CHIEF_VERSION=v1.0.0 - -RUN wget https://github.com/sebdeveloper6952/strfry/releases/download/${STRFRY_VERSION}/strfry -RUN wget https://github.com/sebdeveloper6952/chief/releases/download/${CHIEF_VERSION}/chief - COPY start.sh start.sh + +COPY --from=chief /usr/src/app/chief/target/release/chief /app/code/chief +COPY --from=strfry /build/strfry/strfry /app/code/strfry + RUN chmod +x start.sh strfry chief COPY strfry.conf /app/pkg/strfry.conf COPY chief-config.toml /etc/chief/config.toml COPY chief.json /app/pkg/chief.json +LABEL cloudronManifestPath="CloudronManifest.json" + +EXPOSE 7777 + CMD [ "/app/code/start.sh" ]