-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (27 loc) · 815 Bytes
/
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
# Builder image
FROM node:18-alpine AS builder
WORKDIR /app
# First install dependencies so we can cache them
RUN apk update && apk upgrade
RUN apk add curl
COPY package.json package-lock.json ./
RUN npm install
# Now copy the rest of the app and build it
COPY . .
RUN npm run build
# Production image
FROM node:18-alpine AS runner
WORKDIR /app
# Create a non-root user
RUN addgroup -S nonroot && adduser -S nonroot -G nonroot
USER nonroot
# Copy the standalone output from the builder image
COPY --from=builder --chown=nonroot:nonroot /app/.next/standalone ./
COPY --from=builder --chown=nonroot:nonroot /app/.next/static ./.next/static
# Prepare the app for production
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
ENV HOSTNAME="0.0.0.0"
EXPOSE 3000
# Start the app
CMD ["node", "server.js"]