-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (40 loc) · 1.54 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
FROM node:20.18.1-slim as base
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
## Install Dependencies
FROM base AS dependencies
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --force
## Runner
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED 1
ARG PAYLOAD_URL
ENV PAYLOAD_URL=${PAYLOAD_URL}
ENV NEXT_PUBLIC_PAYLOAD_URL=${PAYLOAD_URL}
ARG FRONTEND_URL
ENV FRONTEND_URL=${FRONTEND_URL}
ENV NEXT_PUBLIC_FRONTEND_URL=${FRONTEND_URL}
ARG TURNSTILE_SITE_KEY
ENV NEXT_PUBLIC_TURNSTILE_SITE_KEY=${TURNSTILE_SITE_KEY}
ARG NEXT_PUBLIC_MATOMO_SITE_ID
ENV NEXT_PUBLIC_MATOMO_SITE_ID=${NEXT_PUBLIC_MATOMO_SITE_ID}
ARG NEXT_PUBLIC_MATOMO_ENDPOINT
ENV NEXT_PUBLIC_MATOMO_ENDPOINT=${NEXT_PUBLIC_MATOMO_ENDPOINT}
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN npm run build && mkdir -p /app/.next/cache
EXPOSE 3000
ENV PORT 3000
VOLUME ["/app/.next/cache"]
CMD ["npm", "run", "start"]