fp/strapi.dockerfile

26 lines
701 B
Docker

FROM node:18.16-alpine as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev libc6-compat git nasm bash gcompat
WORKDIR /app
FROM base AS builder
COPY pnpm-lock.yaml package.json ./
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
FROM builder AS dev
ENV NODE_ENV=development
CMD ["pnpm", "run", "dev"]
FROM builder AS release
ENV NODE_ENV=production
ENTRYPOINT ["pnpm"]
CMD ["run", "start"]