-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (45 loc) · 1.68 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
# Building stage
FROM node:16.13.2-alpine AS builder
ARG STATIC_PREFETCH_API_URL=""
ENV API_URL=$STATIC_PREFETCH_API_URL
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat libtool automake autoconf nasm g++ make libpng-dev
RUN mkdir -p /opt/po8klasie
WORKDIR /opt/po8klasie
COPY package.json yarn.lock .yarnrc.yml ./
# https://yarnpkg.com/features/zero-installs#how-do-you-reach-this-zero-install-state-youre-advocating-for
COPY .yarn ./.yarn
RUN yarn install --immutable
COPY tsconfig.json ./
COPY next.config.js next-env.d.ts ./
COPY postcss.config.js tailwind.config.js ./
COPY public ./public
COPY src ./src
COPY sentry.client.config.ts sentry.server.config.ts ./
COPY next-i18next.config.js ./
RUN yarn build
COPY server.js ./
COPY .prettierrc.js .prettierignore ./
COPY .eslintrc.js .eslintignore ./
COPY jest.config.js ./
COPY entrypoint.tests.sh ./
ENTRYPOINT ["/bin/sh", "-c"]
# Final image stage
FROM node:16.13.2-alpine AS runner
RUN mkdir -p /opt/po8klasie
WORKDIR /opt/po8klasie
ENV NODE_ENV production
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
COPY --from=builder /opt/po8klasie/next.config.js ./
COPY --from=builder /opt/po8klasie/next-i18next.config.js ./
COPY --from=builder /opt/po8klasie/public ./public
COPY --from=builder --chown=nextjs:nodejs /opt/po8klasie/.next ./.next
COPY --from=builder /opt/po8klasie/node_modules ./node_modules
COPY --from=builder /opt/po8klasie/package.json ./package.json
USER nextjs
EXPOSE 3000
ENV PORT 3000
# https://nextjs.org/telemetry
ENV NEXT_TELEMETRY_DISABLED 1
CMD ["yarn", "start"]