diff --git a/Dockerfile.railwayapp b/Dockerfile.railwayapp new file mode 100644 index 0000000..545668d --- /dev/null +++ b/Dockerfile.railwayapp @@ -0,0 +1,57 @@ +## Author Saransh Sharma @cynsar foundation +FROM node:18-alpine3.16 as build + +ARG DB_HOST +ARG DB_PORT +ARG DB_NAME +ARG DB_USER +ARG DB_PASSWORD + +WORKDIR /build + + +COPY ["package.json", "package-lock.json","knexfile.js","./"] + +ADD migrations /build/migrations + +RUN mkdir ~/.nostr + +RUN npm install -g knex@2.3.0 + +RUN npm install knex --quiet + +RUN npm install --quiet + +RUN npm run db:migrate + + + +COPY . . + +RUN npm run build + +FROM node:18-alpine3.16 + +LABEL org.opencontainers.image.title="Nostr Typescript Relay" +LABEL org.opencontainers.image.source=https://github.com/Cameri/nostr-ts-relay +LABEL org.opencontainers.image.description="nostr-ts-relay" +LABEL org.opencontainers.image.authors="Ricardo Arturo Cabral Mejía" +LABEL org.opencontainers.image.licenses=MIT + +## Build Setup for Railways +ENV DB_HOST=$DB_HOST +ENV DB_PORT=$DB_PORT +ENV DB_NAME=$DB_NAME +ENV DB_USER=$DB_USER +ENV DB_PASSWORD=$DB_PASSWORD + + +WORKDIR /app + +COPY --from=build /build/dist . + +RUN npm install --omit=dev --quiet + +USER 1000:1000 + +CMD ["node", "src/index.js"]