-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
92 lines (59 loc) · 1.95 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
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
91
92
FROM node:16 as development
ARG NEXT_PUBLIC_CLIENT_URL
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npx next build
EXPOSE 3000
CMD [ "npm", "run", "dev" ]
FROM node:16-alpine AS builder
ARG NEXT_PUBLIC_CLIENT_URL https://bhzmipgrc2.eu-west-1.awsapprunner.com
WORKDIR /app
COPY --from=development /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_TLS_REJECT_UNAUTHORIZED 1
ENV NEXT_PUBLIC_CLIENT_URL=${NEXT_PUBLIC_CLIENT_URL}
RUN npm run build
FROM node:16-alpine AS testing-builder
ARG NEXT_PUBLIC_CLIENT_URL https://bhzmipgrc2.eu-west-1.awsapprunner.com
WORKDIR /app
COPY --from=development /app/node_modules ./node_modules
COPY . .
COPY .env.dist .env.local
ENV PORT 3000
ENV NODE_ENV test
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_TLS_REJECT_UNAUTHORIZED 1
ENV NEXT_PUBLIC_CLIENT_URL=${NEXT_PUBLIC_CLIENT_URL}
ENV GRAPHQL_URL=http://api:4000/graphql
RUN npm run build
FROM node:16-slim as testing
ENV PORT 3000
ENV NODE_ENV test
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=testing-builder /app/next.config.js ./
COPY --from=testing-builder /app/public ./public
COPY --from=testing-builder /app/package.json ./package.json
COPY --from=testing-builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=testing-builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE $PORT
CMD ["node", "server.js"]
FROM node:16-slim as production
ENV PORT 3000
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE $PORT
CMD ["node", "server.js"]