forked from devfile/landing-page
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (29 loc) · 1.09 KB
/
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
# Rebuild the source code only when needed
FROM registry.access.redhat.com/ubi8/nodejs-14-minimal AS builder
ARG DEVFILE_VIEWER_ROOT
ARG DEVFILE_COMMUNITY_HOST
USER root
WORKDIR /app
RUN npm install -g yarn
COPY . .
RUN $(npm get prefix)/bin/yarn add -D @swc/cli @swc/core
RUN $(npm get prefix)/bin/yarn install --frozen-lockfile --ignore-optional
RUN $(npm get prefix)/bin/yarn build
RUN $(npm get prefix)/bin/yarn install --production --ignore-scripts --prefer-offline --ignore-optional
# Production image, copy all the files and run next
FROM registry.access.redhat.com/ubi8/nodejs-14-minimal AS runner
USER root
WORKDIR /app
RUN microdnf install shadow-utils
ENV NODE_ENV production
RUN groupadd -g 1001 nodejs
RUN useradd nextjs -u 1001
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/webpage_info ./webpage_info
USER nextjs
EXPOSE 3000
CMD ["npm", "start"]