Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/publish-node-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish Node Image

on:
workflow_dispatch:
inputs:
tag_latest:
description: "Also tag this build as latest"
type: boolean
default: false
release:
types:
- published

permissions:
contents: read
packages: write

env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/tn-db

jobs:
build-and-push:
name: Build and Push
runs-on: ubuntu-latest
env:
TAG_LATEST: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.tag_latest == 'true') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ env.TAG_LATEST }}
type=sha
type=ref,event=tag
type=semver,pattern={{version}}

- name: Build and push image (multi-arch)
uses: docker/build-push-action@v5
with:
context: .
file: deployments/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Summary
run: |
echo "Image pushed: ${{ env.IMAGE_NAME }}"
echo "Ref: ${{ github.ref }}"
echo "Tags:\n${{ steps.meta.outputs.tags }}"
15 changes: 8 additions & 7 deletions deployments/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ FROM busybox:1.35.0-uclibc as busybox

FROM alpine:latest

ARG CHAIN_ID=truflation-dev

ENV SETUP_CHAIN_ID=truflation-dev
ENV SETUP_DB_OWNER=
# DB_OWNER will be provided as an environment variable at runtime
ENV CONFIG_PATH=/root/.kwild

WORKDIR /app

Expand All @@ -41,13 +42,13 @@ RUN chmod +x /app/entrypoint.sh

# create the configuration script; note that we are NOT running it here
RUN echo "#!/bin/sh" > /app/config.sh && \
echo "set -e" >> /app/config.sh && \
echo "if [ ! -f /root/.kwild/config.toml ]; then" >> /app/config.sh && \
echo "set -xe" >> /app/config.sh && \
echo "if [ ! -f $CONFIG_PATH/config.toml ]; then" >> /app/config.sh && \
echo " echo 'Configuration does not exist';" >> /app/config.sh && \
echo " echo 'Creating configuration';" >> /app/config.sh && \
echo " ./kwild setup init --chain-id $CHAIN_ID --db-owner \$DB_OWNER -r /root/.kwil-new;" >> /app/config.sh && \
echo " mkdir -p /root/.kwild;" >> /app/config.sh && \
echo " cp /root/.kwil-new/* /root/.kwild;" >> /app/config.sh && \
echo " ./kwild setup init --chain-id \"\$SETUP_CHAIN_ID\" --db-owner \"\$SETUP_DB_OWNER\" -r '/root/.kwil-new';" >> /app/config.sh && \
echo " mkdir -p $CONFIG_PATH;" >> /app/config.sh && \
echo " cp /root/.kwil-new/* $CONFIG_PATH;" >> /app/config.sh && \
echo " rm -rf /root/.kwil-new;" >> /app/config.sh && \
echo " echo 'Configuration created';" >> /app/config.sh && \
echo "else" >> /app/config.sh && \
Expand Down
4 changes: 1 addition & 3 deletions deployments/tn-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ else
echo "Config path set to $CONFIG_PATH"
fi

exec /app/kwild start --root $CONFIG_PATH \
--db.read-timeout "60s"\
--snapshots.enable
exec /app/kwild start --root $CONFIG_PATH
Loading