nostream/Dockerfile.railwayapp

58 lines
1.0 KiB
Docker
Raw Normal View History

2022-11-11 15:52:53 +05:30
## 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"]