update docker and readme

This commit is contained in:
github-tijlxyz 2023-11-04 17:49:31 +01:00
parent 6f22e60a3a
commit c14585ce34
6 changed files with 15 additions and 33 deletions

2
.gitignore vendored
View File

@ -1,6 +1,4 @@
whitelist.json
users.json users.json
khatru-invite khatru-invite
.env .env
khatru-badgern-db
db db

View File

@ -1,35 +1,16 @@
FROM node:latest AS ui-builder # syntax=docker/dockerfile:1
FROM golang:1.21
WORKDIR /app WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . . COPY . .
WORKDIR /app/ui RUN CGO_ENABLED=0 GOOS=linux go build -o /khatru-invite
RUN yarn install
RUN yarn build
FROM golang:1.20 AS go-builder
WORKDIR /app
COPY . .
COPY --from=ui-builder /app/ui/dist /app/ui/dist
RUN go build -o app
FROM golang:1.20
WORKDIR /app
COPY --from=go-builder /app/app /app/app
COPY --from=ui-builder /app/ui/dist /app/ui/dist
EXPOSE 3334 EXPOSE 3334
CMD ["./app"] CMD ["/khatru-invite"]

View File

@ -4,4 +4,4 @@ A relay based on [Khatru](https://github.com/fiatjaf/khatru) with a invite hiera
some notes before running: some notes before running:
1. configure the relay settings in `.env` 1. configure the relay settings in `.env`
2. manually add someone to the `whitelist.json` file, like this: `[{"pk":"07adfda9c5adc80881bb2a5220f6e3181e0c043b90fa115c4f183464022968e6","invited_by":""}]` 2. manually add someone to the `users.json` file, like this: `{"07adfda9c5adc80881bb2a5220f6e3181e0c043b90fa115c4f183464022968e6":""}`

View File

@ -3,13 +3,13 @@ version: '3'
services: services:
khatru-invite: khatru-invite:
restart: unless-stopped restart: unless-stopped
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
- 3334:3334 - 3334:3334
volumes: volumes:
- ./whitelist.json:/app/whitelist.json - ./users.json:/app/users.json
- ./khatru-badgern-db:/app/khatru-badgern-db - ./db:/app/db
env_file: env_file:
- .env - .env

View File

@ -2,3 +2,4 @@ RELAY_NAME="Name of the Relay"
RELAY_DESCRIPTION="Description of the relay" RELAY_DESCRIPTION="Description of the relay"
RELAY_PUBKEY="07adfda9c5adc80881bb2a5220f6e3181e0c043b90fa115c4f183464022968e6" RELAY_PUBKEY="07adfda9c5adc80881bb2a5220f6e3181e0c043b90fa115c4f183464022968e6"
RELAY_CONTACT="email@example.com" RELAY_CONTACT="email@example.com"
DOMAIN="example.com"

2
go.mod
View File

@ -2,6 +2,8 @@ module github.com/github-tijlxyz/khatru-invite
go 1.21.0 go 1.21.0
toolchain go1.21.3
require ( require (
github.com/fiatjaf/eventstore v0.1.0 github.com/fiatjaf/eventstore v0.1.0
github.com/fiatjaf/khatru v0.0.4 github.com/fiatjaf/khatru v0.0.4