Skip to content

Commit

Permalink
Update docker.md. Fixes #1862 (#1863)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndColla authored Oct 3, 2023
1 parent 5104170 commit 0796c0f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docusaurus/docs/dev-docs/installation/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ Sample `Dockerfile`:
```dockerfile title="./Dockerfile"
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
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 package.json 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

Expand All @@ -86,6 +87,7 @@ ENV NODE_ENV=${NODE_ENV}

WORKDIR /opt/
COPY package.json package-lock.json ./
RUN npm install -g node-gyp
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install
ENV PATH /opt/node_modules/.bin:$PATH

Expand Down Expand Up @@ -334,12 +336,13 @@ The following `Dockerfile` can be used to build a production Docker image for a
```dockerfile title="./Dockerfile.prod"
# 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 > /dev/null 2>&1
ARG NODE_ENV=production
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
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
COPY package.json yarn.lock ./
RUN yarn global add node-gyp
RUN yarn config set network-timeout 600000 -g && yarn install --production
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
Expand All @@ -349,7 +352,7 @@ RUN yarn build
# Creating final production image
FROM node:18-alpine
RUN apk add --no-cache vips-dev
ARG NODE_ENV=production
ENV NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
COPY --from=build /opt/node_modules ./node_modules
Expand All @@ -370,12 +373,13 @@ CMD ["yarn", "start"]
```dockerfile title="./Dockerfile.prod"
# 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 > /dev/null 2>&1
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 package-lock.json ./
RUN npm install -g node-gyp
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install --only=production
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
Expand Down

1 comment on commit 0796c0f

@vercel
Copy link

@vercel vercel bot commented on 0796c0f Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

documentation – ./

documentation-strapijs.vercel.app
docs-vercel-v4.strapi.io
documentation-git-main-strapijs.vercel.app

Please sign in to comment.