-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathclient.Dockerfile
More file actions
59 lines (42 loc) · 1.78 KB
/
client.Dockerfile
File metadata and controls
59 lines (42 loc) · 1.78 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
# syntax=docker/dockerfile:1.7-labs
############################ base ##############################
FROM --platform=$TARGETPLATFORM node:25-alpine AS base
RUN apk update && apk add --no-cache libc6-compat curl bash git
RUN npm install -g pnpm@latest
ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
############################ deps ##############################
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/client/package.json ./apps/client/
COPY packages/api/package.json ./packages/api/
COPY packages/shared/package.json ./packages/shared/
RUN --mount=type=cache,id=pnpm-cache,target=/root/.local/share/pnpm \
pnpm install --frozen-lockfile --ignore-scripts
############################ builder ###########################
FROM deps AS builder
WORKDIR /app
ARG SOURCE_COMMIT
ENV SOURCE_COMMIT=${SOURCE_COMMIT}
COPY packages/shared/ ./packages/shared/
COPY packages/api/ ./packages/api/
COPY apps/client/ ./apps/client/
RUN --mount=type=cache,id=pnpm-cache,target=/root/.local/share/pnpm \
pnpm --filter @hackclub/lapse-shared run build && \
pnpm --filter @hackclub/lapse-api run build && \
pnpm --filter @lapse/lapse-client run build
############################ runner ############################
FROM base AS runner
WORKDIR /app
RUN addgroup -S nextjs && adduser -S nextjs -G nextjs
COPY --from=builder --chown=nextjs:nextjs /app/apps/client/.next/standalone ./
COPY --from=builder --chown=nextjs:nextjs /app/apps/client/.next/static ./apps/client/.next/static
COPY --from=builder --chown=nextjs:nextjs /app/apps/client/public ./apps/client/public
USER nextjs
ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV NEXT_TELEMETRY_DISABLED=1
EXPOSE 3000
CMD ["node", "apps/client/server.js"]