-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.web
More file actions
47 lines (34 loc) · 955 Bytes
/
Dockerfile.web
File metadata and controls
47 lines (34 loc) · 955 Bytes
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
# Dockerfile for UET Web (Next.js Frontend)
FROM node:20-bookworm-slim AS builder
WORKDIR /app
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
# Copy package files
COPY uet_web/package*.json ./
# Install dependencies
RUN npm ci --legacy-peer-deps
# Copy source
COPY uet_web ./
# Build Next.js
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build
# Runtime Stage
FROM node:20-bookworm-slim AS runner
WORKDIR /app
ARG DATABASE_URL
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
ENV DATABASE_URL=${DATABASE_URL}
# Create nextjs user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy static files and standalone build
COPY --from=builder /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 web port
EXPOSE 3000
CMD ["node", "server.js"]