fp/strapi.dockerfile

26 lines
701 B
Plaintext
Raw Normal View History

2024-04-02 14:49:33 +00:00
FROM node:18.16-alpine as base
2024-04-08 21:33:49 +00:00
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
2024-04-02 14:49:33 +00:00
RUN corepack enable
# Installing libvips-dev for sharp Compatibility
2024-04-08 18:23:31 +00:00
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev libc6-compat git nasm bash gcompat
2024-04-02 14:49:33 +00:00
WORKDIR /app
2024-04-08 21:40:32 +00:00
FROM base AS builder
2024-04-08 18:23:31 +00:00
COPY pnpm-lock.yaml package.json ./
2024-04-08 21:33:49 +00:00
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
2024-04-02 14:49:33 +00:00
COPY ./packages/strapi .
2024-04-08 18:30:17 +00:00
ENV PATH=/app/node_modules/.bin:$PATH
2024-04-02 14:49:33 +00:00
RUN chown -R node:node /app
USER node
2024-04-08 21:40:32 +00:00
FROM builder AS dev
2024-04-08 18:23:31 +00:00
ENV NODE_ENV=development
2024-04-02 14:49:33 +00:00
CMD ["pnpm", "run", "dev"]
2024-04-08 21:40:32 +00:00
FROM builder AS release
2024-04-08 18:23:31 +00:00
ENV NODE_ENV=production
ENTRYPOINT ["pnpm"]
CMD ["run", "start"]