fp/packages/strapi/Dockerfile

28 lines
783 B
Docker
Raw Normal View History

2024-03-29 07:28:02 +00:00
# Creating multi-stage build for production
FROM node:18-alpine as build
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
ENV NODE_ENV=production
2024-01-20 16:16:14 +00:00
WORKDIR /opt/
COPY package.json yarn.lock ./
2024-03-29 07:28:02 +00:00
RUN yarn global add node-gyp
RUN yarn config set network-timeout 600000 -g && yarn install --production
ENV PATH /opt/node_modules/.bin:$PATH
2024-01-20 16:16:14 +00:00
WORKDIR /opt/app
COPY . .
2024-03-29 07:28:02 +00:00
RUN yarn build
# Creating final production image
FROM node:18-alpine
RUN apk add --no-cache vips-dev
ENV NODE_ENV=production
WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
WORKDIR /opt/app
COPY --from=build /opt/app ./
2024-01-20 16:16:14 +00:00
ENV PATH /opt/node_modules/.bin:$PATH
2024-03-29 07:28:02 +00:00
2024-01-20 16:16:14 +00:00
RUN chown -R node:node /opt/app
USER node
EXPOSE 1337
2024-03-29 07:28:02 +00:00
CMD ["yarn", "start"]