mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(web): tweak docker build
This commit is contained in:
parent
53a5c6c44d
commit
de5a380928
2 changed files with 18 additions and 16 deletions
9
web/.dockerignore
Normal file
9
web/.dockerignore
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# https://github.com/vercel/next.js/blob/canary/examples/with-docker/.dockerignore
|
||||
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
||||
|
|
@ -10,13 +10,11 @@ FROM base AS deps
|
|||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies based on the preferred package manager
|
||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
|
||||
RUN --mount=type=cache,target=/app/.next/cache \
|
||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||
elif [ -f package-lock.json ]; then npm ci; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
# Install dependencies based on npm
|
||||
COPY package.json package-lock.json* .npmrc* ./
|
||||
RUN \
|
||||
if [ -f package-lock.json ]; then npm ci; \
|
||||
else echo "package-lock.json not found." && exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -26,16 +24,12 @@ WORKDIR /app
|
|||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Next.js collects completely anonymous telemetry data about general usage.
|
||||
# Learn more here: https://nextjs.org/telemetry
|
||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||
# https://nextjs.org/telemetry
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn run build; \
|
||||
elif [ -f package-lock.json ]; then npm run build; \
|
||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
RUN --mount=type=cache,target=/app/.next/cache \
|
||||
if [ -f package-lock.json ]; then npm run build; \
|
||||
else echo "package-lock.json not found." && exit 1; \
|
||||
fi
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
|
|
@ -43,7 +37,6 @@ FROM base AS runner
|
|||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
|
|
|
|||
Loading…
Reference in a new issue