fp/strapi.dockerfile

50 lines
1.4 KiB
Docker

# 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
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 build
# COPY package.json pnpm-lock.yaml ./
COPY pnpm-lock.yaml package.json ./
# RUN yarn config set network-timeout 600000 -g && yarn install
# RUN pnpm install --frozen-lockfile
RUN 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
ENV NODE_ENV=development
CMD ["pnpm", "run", "dev"]
FROM build AS release
ENV NODE_ENV=production
ENTRYPOINT ["pnpm"]
CMD ["run", "start"]