forked from gothinkster/realworld-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Dockerfile
29 lines (26 loc) · 870 Bytes
/
Dockerfile
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
FROM alpine:3 AS base
RUN apk add --update nodejs
WORKDIR /app
FROM base AS build
# install tools
RUN apk update \
&& apk add npm jq \
&& rm -rf /var/cache/apk/*
# install dependencies
COPY . .
RUN npm ci
# build sources
RUN npm run build
RUN npm ci --production --ignore-scripts
FROM base
ENV NODE_ENV production
ENV DATABASE_URL file:data.db
ENV JWT_SECRET_KEY secret_key
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./
CMD ["node", "/app/src/main.js"]
# docker build . -t nestjs-graphql-prisma-realworld-example-app
# docker run -it -v "$PWD/data":/data -e DATABASE_URL=file:/data/db.sqlite -p 8080:3000 nestjs-graphql-prisma-realworld-example-app
# docker run -it -p 8080:3000 nestjs-graphql-prisma-realworld-example-app
# curl -i http://localhost:8080/api
# docker run -it nestjs-graphql-prisma-realworld-example-app sh