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
|
RUN apk add --no-cache libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
ARG FONTAWESOME_PACKAGE_TOKEN
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# 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 \
|
RUN \
|
||||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
if [ -n "$FONTAWESOME_PACKAGE_TOKEN" ]; then \
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
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; \
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
fi; \
|
||||||
elif [ -f bun.lock ]; then bun install --frozen-lockfile; \
|
bun install --frozen-lockfile; \
|
||||||
else echo "Lockfile not found." && exit 1; \
|
rm -f .npmrc
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# 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.
|
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||||
# ENV NEXT_TELEMETRY_DISABLED 1
|
# ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
RUN \
|
RUN bun run build
|
||||||
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
|
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue