diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1d4d1db --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +npm-debug.log +*.md +LICENSE diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b1e1e8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM --platform=linux/amd64 node:19-alpine3.16 + +RUN apk add \ + bash \ + ca-certificates + +RUN mkdir -p /usr/local/share/ca-certificates \ + && chmod 333 /usr/local/share/ca-certificates + # && chmod 333 /etc/ssl/certs # this doesn't work + +# RUN addgroup -g 2001 -S lnurl && adduser -u 1001 -S lnurl -G lnurl + +WORKDIR /usr/src/app + +COPY package*.json ./ +RUN npm ci --omit=dev +# install dependencies +RUN npm install knex pg + +COPY . . +RUN chmod +x ./entrypoint.sh + # && chown lnurl:lnurl -R /usr/src/app + +EXPOSE 3000 +# USER lnurl +CMD ["./entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..544d387 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# add self-signed lnd cert to system + +cp $LND_CERT_PATH /usr/local/share/ca-certificates/lnd.crt +update-ca-certificates + +node cli.js server --host "$LNURL_HOST" \ + --port "$LNURL_PORT" \ + --lightning.backend "lnd" \ + --lightning.config "{\"hostname\": \"$LND_HOST:$LND_PORT\", \"macaroon\": \"$LND_MACAROON_PATH\", \"cert\": \"$LND_CERT_PATH\"}" \ + --store.backend "knex" \ + --store.config "{\"client\":\"postgres\",\"connection\":{\"host\":\"$POSTGRES_HOST\",\"user\":\"$POSTGRES_USER\",\"password\":\"$POSTGRES_PASSWORD\",\"database\":\"$POSTGRES_DB\"}}" \ No newline at end of file