strapi #3
1 changed files with 29 additions and 0 deletions
29
strapi/Dockerfile
Normal file
29
strapi/Dockerfile
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Creating multi-stage build for production
|
||||
FROM oven/bun:1.2-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
|
||||
ARG NODE_ENV=production
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
|
||||
WORKDIR /opt/
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun add --global node-gyp && bun install --production --frozen-lockfile
|
||||
ENV PATH=/opt/node_modules/.bin:$PATH
|
||||
WORKDIR /opt/app
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
# Creating final production image
|
||||
FROM node:18-alpine
|
||||
RUN apk add --no-cache vips-dev
|
||||
ENV NODE_ENV=production
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
WORKDIR /opt/
|
||||
COPY --from=build /opt/node_modules ./node_modules
|
||||
WORKDIR /opt/app
|
||||
COPY --from=build /opt/app ./
|
||||
ENV PATH=/opt/node_modules/.bin:$PATH
|
||||
|
||||
RUN chown -R node:node /opt/app
|
||||
USER node
|
||||
EXPOSE 1337
|
||||
CMD ["yarn", "start"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue