v1.0.0
This commit is contained in:
parent
652c6da746
commit
9d7b2669bc
10
Dockerfile
10
Dockerfile
|
@ -0,0 +1,10 @@
|
||||||
|
FROM node:alpine as build
|
||||||
|
RUN apk add --no-cache git nginx
|
||||||
|
RUN git clone https://github.com/dtonon/oracolo.git /app
|
||||||
|
WORKDIR /app
|
||||||
|
COPY entrypoint.sh /app/
|
||||||
|
COPY nginx.conf /app/
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
|
EXPOSE 8080/tcp
|
||||||
|
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
|
65
entrypoint.sh
Normal file
65
entrypoint.sh
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/sh
|
||||||
|
echo
|
||||||
|
echo "Starting oracolo..."
|
||||||
|
echo
|
||||||
|
echo "Oracolo dtonon's repo: https://github.com/dtonon/oracolo"
|
||||||
|
src_index_html="/app/index.html"
|
||||||
|
echo
|
||||||
|
echo "╭────────────────────────────╮"
|
||||||
|
echo "│ Docker Compose Env Vars ⤵️ │"
|
||||||
|
echo "╰────────────────────────────╯"
|
||||||
|
echo
|
||||||
|
printf "%-15s : %s\n" "NPUB" "$NPUB"
|
||||||
|
printf "%-15s : %s\n" "RELAYS" "$RELAYS"
|
||||||
|
printf "%-15s : %s\n" "TOP_NOTES_NB" "$TOP_NOTES_NB"
|
||||||
|
echo
|
||||||
|
echo "╭───────────────────────────╮"
|
||||||
|
echo "│ Configuring Oracolo... ⤵️ │"
|
||||||
|
echo "╰───────────────────────────╯"
|
||||||
|
echo
|
||||||
|
echo -n "> Updating npub key with $NPUB... "
|
||||||
|
sed -i "s/replace_with_your_npub/$NPUB/" $src_index_html
|
||||||
|
echo "✅"
|
||||||
|
echo -n "> Updating nostr relays with $RELAYS... "
|
||||||
|
old_relays="wss://nos.lol, wss://relay.damus.io, wss://nostr.wine"
|
||||||
|
RELAYS=$(echo $RELAYS | sed 's/^"//' | sed 's/"$//')
|
||||||
|
sed -i "s|$old_relays|$RELAYS|g" $src_index_html
|
||||||
|
echo "✅"
|
||||||
|
echo -n "> Updating TOP_NOTE with value $TOP_NOTES_NB... "
|
||||||
|
old_TOP_NOTES='name="top-notes" value="0"'
|
||||||
|
TOP_NOTES="name=\"top-notes\" value=\"$TOP_NOTES_NB\""
|
||||||
|
sed -i "s|$old_TOP_NOTES|$TOP_NOTES|g" $src_index_html
|
||||||
|
echo "✅"
|
||||||
|
echo
|
||||||
|
echo "╭───────────────────────╮"
|
||||||
|
echo "│ Installing Oracolo ⤵️ │"
|
||||||
|
echo "╰───────────────────────╯"
|
||||||
|
npm install
|
||||||
|
echo
|
||||||
|
echo ">>> done ✅"
|
||||||
|
echo
|
||||||
|
echo "╭─────────────────────╮"
|
||||||
|
echo "│ Building Oracolo ⤵️ │"
|
||||||
|
echo "╰─────────────────────╯"
|
||||||
|
npm run build
|
||||||
|
echo
|
||||||
|
echo ">>> done ✅"
|
||||||
|
echo
|
||||||
|
echo -n "> Copying Oracolo built index.html to nginx usr/share/nginx/html... "
|
||||||
|
mkdir /usr/share/nginx/html
|
||||||
|
cp /app/dist/index.html /usr/share/nginx/html
|
||||||
|
echo "✅"
|
||||||
|
echo
|
||||||
|
echo "╭────────────────────────╮"
|
||||||
|
echo "│ Configuring Nginx... ⤵️ │"
|
||||||
|
echo "╰────────────────────────╯"
|
||||||
|
echo
|
||||||
|
echo -n "> Copying default nginx.conf file... "
|
||||||
|
cp /app/nginx.conf /etc/nginx/http.d/oracolo.conf
|
||||||
|
echo "✅"
|
||||||
|
echo
|
||||||
|
echo "╭──────────────────────╮"
|
||||||
|
echo "│ Starting Nginx... 🚀 │"
|
||||||
|
echo "╰──────────────────────╯"
|
||||||
|
echo
|
||||||
|
exec "$@"
|
15
nginx.conf
Normal file
15
nginx.conf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue