-
Notifications
You must be signed in to change notification settings - Fork 229
Expand file tree
/
Copy pathDockerfile.railwayapp
More file actions
90 lines (68 loc) · 1.92 KB
/
Dockerfile.railwayapp
File metadata and controls
90 lines (68 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
## Author Saransh Sharma @cynsar foundation
FROM node:24-alpine as build
ARG PORT
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 npm install -g knex@2.4.0 && npm install --quiet
COPY . .
RUN npm run build
FROM node:24-alpine
# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init
ARG PORT
ARG PGHOST
ARG PGPORT
ARG PGDATABASE
ARG PGUSER
ARG PGPASSWORD
ARG REDISHOST
ARG REDISUSER
ARG REDISPORT
ARG REDISPASSWORD
ARG DEBUG
ARG DB_MIN_POOL_SIZE=16
ARG DB_MAX_POOL_SIZE=64
ARG WORKER_COUNT=8
ENV WORKER_COUNT=$WORKER_COUNT
ENV RELAY_PORT=$PORT
ENV DB_HOST=$PGHOST
ENV DB_PORT=$PGPORT
ENV DB_NAME=$PGDATABASE
ENV DB_USER=$PGUSER
ENV DB_PASSWORD=$PGPASSWORD
ENV DB_MIN_POOL_SIZE=$DB_MIN_POOL_SIZE
ENV DB_MAX_POOL_SIZE=$DB_MAX_POOL_SIZE
ENV NOSTR_CONFIG_DIR=/home/node/.nostr
ENV REDIS_HOST=$REDISHOST
ENV REDIS_PORT=$REDISPORT
ENV REDIS_USER=$REDISUSER
ENV REDIS_PASSWORD=$REDISPASSWORD
LABEL org.opencontainers.image.title="Nostream"
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 runtime artifacts and configuration
COPY --from=build /build/dist .
COPY --from=build /build/package.json /build/package-lock.json ./
COPY --from=build /build/knexfile.js ./
COPY --from=build /build/migrations ./migrations
COPY --from=build /build/seeds ./seeds
RUN npm install --omit=dev --quiet && npm install -g knex@2.4.0
USER 1000:1000
RUN mkdir -p $NOSTR_CONFIG_DIR
ENTRYPOINT ["dumb-init", "--"]
CMD ["sh", "-c", "npm run db:migrate && node src/index.js"]