Create a Custom Strapi Image

Create a Custom Strapi Image

·

1 min read

Select Image

There are 2 types of image provided by the Strapi:

strapi/strapi is for creating new project and development.

strapi/base is a clean image for building a custom production image

Create new Project

You can create a new strapi project via npm, yarn or docker. It does not affect the image building.

Create an image

Before create the image, please install the docker and has already created a strapi project in the working directory.

Create a Dockerfile with following information at project root level.

FROM strapi/base WORKDIR /strapi-app COPY ./package.json ./ COPY ./yarn.lock ./ RUN yarn install COPY . . ENV <NODE_ENV_VERSION> production RUN yarn build EXPOSE 1337 CMD ["yarn", "start"]

Run docker build -t <TAG_NAME> to build an image

Run docker images to check whether the <TAG_NAME> image is built successfully.