-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (38 loc) · 1.9 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
FROM node:16-alpine3.16 AS builder
RUN mkdir -p /app
WORKDIR /app
COPY package.json /app
COPY yarn.lock /app
RUN yarn install
COPY . /app
EXPOSE 3000
RUN npx prisma generate
RUN --mount=type=secret,id=NEXT_PUBLIC_OPENCAGE_API_KEY \
NEXT_PUBLIC_OPENCAGE_API_KEY="$(cat /run/secrets/NEXT_PUBLIC_OPENCAGE_API_KEY)" \
yarn build
# RUN --mount=type=secret,id=NEXT_PUBLIC_OPENCAGE_API_KEY NEXT_PUBLIC_OPENCAGE_API_KEY="$(cat /run/secrets/NEXT_PUBLIC_OPENCAGE_API_KEY)", \
# --mount=type=secret,id=NEXT_PUBLIC_DATABASE_URL NEXT_PUBLIC_DATABASE_URL="$(cat /run/secrets/NEXT_PUBLIC_DATABASE_URL)" \
# yarn build
# RUN --mount=type=secret,\
# id=NEXT_PUBLIC_OPENCAGE_API_KEY NEXT_PUBLIC_OPENCAGE_API_KEY="$(cat /run/secrets/NEXT_PUBLIC_OPENCAGE_API_KEY)" yarn build
# fly deploy \
# --build-secret NEXT_PUBLIC_OPENCAGE_API_KEY=116d85870b9e49a187bf65380825f926
# --build-secret DATABASE_URL=postgresql://postgres:postgres@localhost:5432/crystal_index_dev?schema=public --remote-only
# fly deploy \
# --build-secret NEXT_PUBLIC_OPENCAGE_API_KEY=116d85870b9e49a187bf65380825f926 --remote-only
FROM node:16-alpine3.16
RUN mkdir -p /app
WORKDIR /app
COPY --from=builder /app/prisma /app/prisma
COPY --from=builder /app/node_modules/.prisma /app/node_modules/.prisma
COPY --from=builder /app/.next /app/.next
COPY --from=builder /app/public /app/public
COPY --from=builder /app/app /app/app
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY package.json /app
COPY yarn.lock /app
RUN yarn install --production
CMD ["yarn", "start"]