-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (40 loc) · 1.59 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
FROM node:18-alpine AS base
FROM base AS builder
ARG KINDE_ISSUER_URL="override_me"
ARG KINDE_CLIENT_ID="override_me"
ARG KINDE_CLIENT_SECRET="override_me"
ENV KINDE_ISSUER_URL ${KINDE_ISSUER_URL}
ENV KINDE_CLIENT_ID ${KINDE_CLIENT_ID}
ENV KINDE_CLIENT_SECRET ${KINDE_CLIENT_SECRET}
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app
RUN yarn global add turbo@^2
COPY . .
RUN touch ./apps/votingsystem/.env && echo "KINDE_ISSUER_URL=${KINDE_ISSUER_URL}" > ./apps/votingsystem/.env && echo "KINDE_CLIENT_ID=${KINDE_CLIENT_ID}" >> ./apps/votingsystem/.env && echo "KINDE_CLIENT_SECRET=${KINDE_CLIENT_SECRET}" >> ./apps/votingsystem/.env
RUN turbo prune web --docker
FROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install
COPY --from=builder /app/out/full/ .
RUN cd ./packages/prismadb && npx prisma generate && cd ../..
RUN yarn turbo run build --filter=web...
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 app
RUN adduser --system --uid 1001 app
RUN mkdir .next
RUN chown app:app .next
COPY --from=installer --chown=app:app /app/apps/votingsystem/next.config.mjs .
COPY --from=installer --chown=app:app /app/apps/votingsystem/package.json .
COPY --from=installer --chown=app:app /app/apps/votingsystem/.next/standalone ./
COPY --from=installer --chown=app:app /app/apps/votingsystem/.next/static ./apps/votingsystem/.next/static
USER app
CMD node apps/votingsystem/server.js