Skip to content
Open
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
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:bookworm AS build
WORKDIR /app
COPY . .
RUN go mod download \
&& go build -tags=lmdb -ldflags "-X main.version=$(git describe --tags --always)" -o chronicle . \
&& go clean -modcache

FROM golang:bookworm
COPY --from=build /app /app


WORKDIR /app
ENV RELAY_NAME="Cronicle Relay"
ENV RELAY_DESCRIPTION="Nostr Personal Relay"
ENV RELAY_PORT="3334"
ENV DB_PATH="db/"
ENV REFRESH_INTERVAL=24
ENV MIN_FOLLOWERS=3
ENV FETCH_SYNC="FALSE"
VOLUME ["/app/db"]
EXPOSE 3334
ENTRYPOINT ["/app/entrypoint.sh"]
28 changes: 28 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Define the output file
OUTPUT_FILE=".env"

# Define the required environment variables
REQUIRED_VARS=("OWNER_PUBKEY")

# Define the all environment variables
ALL_VARS=("OWNER_PUBKEY" "RELAY_NAME" "RELAY_DESCRIPTION" "RELAY_URL" "RELAY_ICON" "RELAY_CONTACT" "DB_PATH" "REFRESH_INTERVAL" "MIN_FOLLOWERS" "FETCH_SYNC" "POW_WHITELIST" "POW_DM_WHITELIST")

# Check if all required environment variables are set
for var in "${REQUIRED_VARS[@]}"; do
if [ -z "${!var}" ]; then
echo "Error: Environment variable $var is not set."
exit 1
fi
done

#Recreate conf file
truncate -s 0 $OUTPUT_FILE

# Write environment variables to the output file
for var in "${ALL_VARS[@]}"; do
echo "$var=`printenv ${var}`" >> "$OUTPUT_FILE"
done

./chronicle