Skip to content

glenpalmer/Container-Docusaurus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Container-Docusaurus

This install is based on an example of Mac OS X using Podman and version 3.10 of Docusaurs.

Containerfile

First create a Containerfile that will be used to build an image, the Containerfile should be as follows:-

FROM node:lts-alpine

RUN npx create-docusaurus@latest /home/node/docusaurus classic --javascript && \
    chown -R node:node /home/node/docusaurus

USER node

WORKDIR /home/node/docusaurus

RUN cd /home/node/docusaurus && yarn install

COPY . .

CMD ["yarn", "start", "--host", "0.0.0.0"]

Build the Image

Now build the images using the following command. Note that all files and execution of the build command will be in ~/Container/Podman/docusaurus

podman build -t docusaurus:latest .

Create a Container

First create a base container based on the image, this why it'll be possible to take a copy of all the base files used by Docusaurus. Keeping a local copy of these files means keeping persistent data when running the container in the future, not these container will be dumped once a copy of the files has been taken.

podman container create --name base docusaurus:latest

Run the Container

Run the container from Podman desktop

Copy files from Container

To keep persistent data with the container locally, copy the base files from container to a local directory, in this case it'll be ~/Container/Podman/docusaurus.

podman cp base:/home/node/docusaurus/. ~/Container/Podman/docusaurus

Note: can remove the directory node_modules as these are not required to be mounted.

Remove BASE container

With a copy of the files from the base container, this can be stopped in Podman Desktop and deleted.

Create Final Container

Create the container again and map the local volumes to the conatiner to keep persistent data,

podman container create -p 3000:3000 --name docusaurus \
 -v ${PWD}/blog:/home/node/docusaurus/blog \
 -v ${PWD}/docs:/home/node/docusaurus/docs \
 -v ${PWD}/static:/home/node/docusaurus/static \
 -v ${PWD}/src:/home/node/docusaurus/src \
 -v ${PWD}/docusaurus.config.js:/home/node/docusaurus/docusaurus.config.js \
 -v ${PWD}/package-lock.json:/home/node/docusaurus/package-lock.json \
 -v ${PWD}/package.json:/home/node/docusaurus/package.json \
 -v ${PWD}/sidebars.js:/home/node/docusaurus/sidebars.js \
 -v ${PWD}/sidebars.js:/home/node/docusaurus/yarn.lock \
 docusaurus:latest

A new container will be created, use Podman Desktop to start and stop this container and develop as required.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors