-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (45 loc) · 1.77 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (45 loc) · 1.77 KB
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
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --no-audit --no-fund
FROM node:22-alpine AS builder
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
ARG NEXT_PUBLIC_SITE_URL
ARG NEXT_PUBLIC_MATOMO_URL
ARG NEXT_PUBLIC_MATOMO_SITE_ID
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL \
NEXT_PUBLIC_MATOMO_URL=$NEXT_PUBLIC_MATOMO_URL \
NEXT_PUBLIC_MATOMO_SITE_ID=$NEXT_PUBLIC_MATOMO_SITE_ID
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN --mount=type=cache,target=/app/.next/cache \
npm run build
FROM node:22-alpine AS runner
LABEL org.opencontainers.image.title="mlbb" \
org.opencontainers.image.description="Mobile Legends: Bang Bang knowledge base — heroes, builds, tier list and news." \
org.opencontainers.image.source="https://github.com/achedon12/mlbb" \
org.opencontainers.image.licenses="MIT"
WORKDIR /app
ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \
PORT=3001 \
HOSTNAME=0.0.0.0 \
DATA_DIR=/app/donnees-serveur
# The data folder exists in the image, owned by the user: a named volume
# mounted on it inherits that ownership when it is created.
RUN apk add --no-cache wget \
&& addgroup -g 1001 -S nodejs \
&& adduser -u 1001 -S nextjs -G nodejs \
&& mkdir -p /app/donnees-serveur \
&& chown nextjs:nodejs /app/donnees-serveur
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3001
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget -qO- http://127.0.0.1:3001/api/health || exit 1
STOPSIGNAL SIGTERM
CMD ["node", "server.js"]