build: remove pnpm

This commit is contained in:
pablohashescobar 2022-12-13 02:06:25 +05:30
parent ef216ca714
commit 5d37c061a2
4 changed files with 83 additions and 31 deletions

View file

@ -1,4 +1,4 @@
FROM node:alpine AS builder
FROM node:18-alpine AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
@ -6,30 +6,16 @@ WORKDIR /app
RUN apk add curl
RUN curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; chmod +x /bin/pnpm;
ENV PNPM_HOME="pnpm"
ENV PATH="${PATH}:./pnpm"
COPY ./apps ./apps
COPY ./package.json ./package.json
COPY ./.eslintrc.json ./.eslintrc.json
COPY ./turbo.json ./turbo.json
COPY ./pnpm-workspace.yaml ./pnpm-workspace.yaml
COPY ./pnpm-lock.yaml ./pnpm-lock.yaml
COPY ./yarn.lock ./yarn.lock
RUN pnpm add -g turbo
RUN yarn global add turbo
RUN turbo prune --scope=app --docker
# Add lockfile and package.json's of isolated subworkspace
FROM node:alpine AS installer
RUN apk add curl
RUN curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; chmod +x /bin/pnpm;
ENV PNPM_HOME="pnpm"
ENV PATH="${PATH}:./pnpm"
FROM node:18-alpine AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
@ -38,16 +24,16 @@ WORKDIR /app
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install
# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
# RUN pnpm add -g turbo
RUN pnpm turbo run build --filter=app...
FROM node:alpine AS runner
RUN yarn turbo run build --filter=app...
FROM node:18-alpine AS runner
WORKDIR /app
# Don't run production as root
@ -63,4 +49,6 @@ COPY --from=installer /app/apps/app/package.json .
COPY --from=installer --chown=captain:plane /app/apps/app/.next/standalone ./
COPY --from=installer --chown=captain:plane /app/apps/app/.next/static ./apps/app/.next/static
EXPOSE 3000
CMD node apps/app/server.js