chore: update Dockerfile to streamline dependency installation and add FontAwesome token support
This commit is contained in:
parent
7af4ba4bfb
commit
7a67de7b49
1 changed files with 9 additions and 14 deletions
23
Dockerfile
23
Dockerfile
|
|
@ -9,15 +9,16 @@ FROM base AS deps
|
|||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
ARG FONTAWESOME_PACKAGE_TOKEN
|
||||
|
||||
# Install dependencies based on the preferred package manager
|
||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lock* ./
|
||||
COPY package.json bun.lock* ./
|
||||
RUN \
|
||||
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; \
|
||||
elif [ -f bun.lock ]; then bun install --frozen-lockfile; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
if [ -n "$FONTAWESOME_PACKAGE_TOKEN" ]; then \
|
||||
printf "@fortawesome:registry=https://npm.fontawesome.com/\n@awesome.me:registry=https://npm.fontawesome.com/\n//npm.fontawesome.com/:_authToken=%s\n" "$FONTAWESOME_PACKAGE_TOKEN" > .npmrc; \
|
||||
fi; \
|
||||
bun install --frozen-lockfile; \
|
||||
rm -f .npmrc
|
||||
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
|
|
@ -31,13 +32,7 @@ COPY . .
|
|||
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||
# 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; \
|
||||
elif [ -f bun.lock ]; then bun run build; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
RUN bun run build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
FROM base AS runner
|
||||
|
|
|
|||
Loading…
Reference in a new issue