main-site/Dockerfile
Neshura cab30b7a7d
Some checks failed
Run Tests on Code / test (push) Successful in 2m27s
Build and Release Docker Image / test (push) Successful in 3m0s
Build and Release Docker Image / build (push) Failing after 1m47s
Update Dockerfile
2023-12-20 08:46:49 +00:00

45 lines
No EOL
1,003 B
Docker

## INIT STEP
# Install dependencies only when needed
FROM node:18-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Copy the files needed to install deps
COPY package.json yarn.lock ./
RUN yarn install --cpu=x64 --os=linux --libc=musl --frozen-lockfile
## BUILD STEP
# Rebuild the source code only when needed
FROM node:18-alpine AS builder
WORKDIR /app
# Copy node_modules installed by the deps step
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build
## RUN STEP
FROM node:18-alpine AS runner
LABEL author="neshura@neshweb.net"
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# expose port 3000
ENV PORT 3000
EXPOSE 3000
CMD [ "yarn", "start" ]