nostream/Dockerfile.railwayapp
Ricardo Arturo Cabral Mejía cf44523188 chore: rename project to nostream
2022-12-24 15:56:52 -05:00

57 lines
1015 B
Docker

## Author Saransh Sharma @cynsar foundation
FROM node:18-alpine3.16 as build
ARG PGHOST
ARG PGPORT
ARG PGDATABASE
ARG PGUSER
ARG PGPASSWORD
WORKDIR /build
## Build Setup for Railways
ENV DB_HOST=$PGHOST
ENV DB_PORT=$PGPORT
ENV DB_NAME=$PGDATABASE
ENV DB_USER=$PGUSER
ENV DB_PASSWORD=$PGPASSWORD
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/nostream
LABEL org.opencontainers.image.description="nostream"
LABEL org.opencontainers.image.authors="Ricardo Arturo Cabral Mejía"
LABEL org.opencontainers.image.licenses=MIT
WORKDIR /app
COPY --from=build /build/dist .
RUN npm install --omit=dev --quiet
USER 1000:1000
CMD ["node", "src/index.js"]