In case you're not aware, headless Hashnode is a purpose-built CMS that allows developers to utilize Hashnode's fantastic editor and CMS while still having complete control over the UI customization. To simplify the process, we also provide a Next.js starter kit that anyone can easily deploy on their preferred cloud platform.
While working with several users, I realized they could benefit from a
Dockerfile that allows them to easily deploy their own blog. So, I created this
COPY . /app
# Set the working directory
# Install pnpm
RUN npm install -g pnpm
# By default, use the enterprise theme
RUN pnpm install --frozen-lockfile
RUN pnpm build
# Expose the port Next.js runs on
# Run the Next.js start script
CMD ["pnpm", "start"]
Now, let's see how you can see a live demo of your own blog in 4 easy steps:
In your terminal,
cd into either
.env.example, and copy the values into
.env.local in the same directory. Replace the value of
NEXT_PUBLIC_HASHNODE_PUBLICATION_HOST with your blog's hostname.
cd into the root of the project, and run the following commands to run the app:
docker build --build-arg THEME=personal -t hn-blog .
docker run -d -p 3000:3000 hn-blog
With these steps completed, you should now be able to view a live demo. Simply open your browser and enter the URL