rename the build stage to builder

This commit is contained in:
Chris Grimmett 2024-04-08 13:40:32 -08:00
parent 54efef09d4
commit d72ea5814e
1 changed files with 3 additions and 29 deletions

View File

@ -1,23 +1,3 @@
# FROM node:18-alpine
# # Installing libvips-dev for sharp Compatibility
# RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
# ARG NODE_ENV=development
# ENV NODE_ENV=${NODE_ENV}
# WORKDIR /opt/
# COPY ./packages/strapi/package.json ./packages/strapi/yarn.lock ./
# RUN yarn global add node-gyp
# RUN yarn config set network-timeout 600000 -g && yarn install
# ENV PATH /opt/node_modules/.bin:$PATH
# WORKDIR /opt/app
# COPY ./packages/strapi .
# RUN chown -R node:node /opt/app
# USER node
# RUN ["yarn", "build"]
# EXPOSE 1337
# CMD ["yarn", "dev"]
FROM node:18.16-alpine as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
@ -27,26 +7,20 @@ RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev l
WORKDIR /app
FROM base AS build
# COPY package.json pnpm-lock.yaml ./
FROM base AS builder
COPY pnpm-lock.yaml package.json ./
# RUN yarn config set network-timeout 600000 -g && yarn install
# RUN pnpm install --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY ./packages/strapi .
ENV PATH=/app/node_modules/.bin:$PATH
RUN chown -R node:node /app
USER node
# RUN pnpm run build
# EXPOSE 1337
FROM build AS dev
FROM builder AS dev
ENV NODE_ENV=development
CMD ["pnpm", "run", "dev"]
FROM build AS release
FROM builder AS release
ENV NODE_ENV=production
ENTRYPOINT ["pnpm"]
CMD ["run", "start"]