-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
55 lines (41 loc) · 1.34 KB
/
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
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
### BASE ###
FROM node:14-buster-slim as base
RUN apt-get update && apt-get install --no-install-recommends --yes openssl
WORKDIR /app
# Copy all package.json files
COPY *.json nuxt.config.js yarn.lock ./
COPY client/nuxt/*.json ./client/nuxt/
COPY client/nuxt/nuxt.config.js ./client/nuxt/
COPY providers/mailer/*.json ./providers/mailer/
COPY server/backend/*.json ./server/backend/
COPY server/config/*.json ./server/config/
COPY server/prisma/*.json ./server/prisma/
COPY server/schema/*.json ./server/schema/
### BUILDER ###
FROM base AS builder
# Install production dependencies
RUN yarn install --production --pure-lockfile
RUN cp -RL ./node_modules/ /tmp/node_modules/
# Install all dependencies
RUN yarn install --pure-lockfile
# Copy source files
COPY .gitignore *.js *.ts ./
COPY client/ ./client/
COPY providers/ ./providers/
COPY server/ ./server/
# Build
RUN yarn build
### RUNNER ###
FROM base
ENV NODE_ENV production
# Copy runtime dependencies
COPY --from=builder /tmp/node_modules/ ./node_modules/
COPY --from=builder /app/node_modules/.prisma/client/ ./node_modules/.prisma/client/
COPY --from=builder /app/server/prisma/ ./server/prisma/
COPY --from=builder /app/.nuxt/ ./.nuxt/
COPY --from=builder /app/dist/ ./dist/
COPY ./docker-entrypoint.sh /
USER node
EXPOSE 4000
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["node", "./dist/main.js"]