2024-04-02 14:49:33 +00:00
|
|
|
# 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
|
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
|
|
|
|
|
|
|
|
|
|
|
|
FROM base AS build
|
|
|
|
# COPY package.json pnpm-lock.yaml ./
|
2024-04-08 18:23:31 +00:00
|
|
|
COPY pnpm-lock.yaml package.json ./
|
2024-04-02 14:49:33 +00:00
|
|
|
# RUN yarn config set network-timeout 600000 -g && yarn install
|
|
|
|
# RUN pnpm install --frozen-lockfile
|
|
|
|
|
2024-04-08 18:23:31 +00:00
|
|
|
RUN 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
|
|
|
|
# RUN pnpm run build
|
|
|
|
# EXPOSE 1337
|
|
|
|
|
|
|
|
|
|
|
|
FROM build 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"]
|
|
|
|
|
|
|
|
FROM build AS release
|
2024-04-08 18:23:31 +00:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
ENTRYPOINT ["pnpm"]
|
|
|
|
CMD ["run", "start"]
|