forked from uc-cdis/commons-frontend-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (24 loc) · 820 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
# Build stage
FROM node:20-slim AS builder
WORKDIR /gen3
COPY ./package.json ./package-lock.json ./next.config.js ./tsconfig.json ./.env.development ./tailwind.config.js ./postcss.config.js ./start.sh ./
RUN npm ci
COPY ./src ./src
COPY ./public ./public
COPY ./config ./config
RUN npm install @swc/core @napi-rs/magic-string && \
npm run build
# Production stage
FROM node:20-slim AS runner
WORKDIR /gen3
ENV PORT=3000
RUN addgroup --system --gid 1001 nextjs && \
adduser --system --uid 1001 nextjs
COPY --from=builder /gen3/node_modules ./node_modules
COPY --from=builder /gen3/config ./config
COPY --from=builder /gen3/public ./public
COPY --from=builder --chown=nextjs:nextjs /gen3/.next ./.next
COPY --from=builder /gen3/start.sh /gen3/package.json ./
USER nextjs
ENV PORT=3000
CMD bash ./start.sh