Reputation: 1235
I have recently started working with Docker
in a simple environment.
I have created a simple blog with the static website generator gatsbyJS.
I have containerized my app with docker:
//Dockerfile
FROM node:11.9.0
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
RUN npm install -g gatsby-cli
COPY . .
EXPOSE 8000
CMD ["gatsby", "develop", "-H", "0.0.0.0"]
Everything has been pushed and deployed on my server and works as expected.
Each blog post is a markdown file read by gatsbyjs.
My understanding is when all my app will be ready (javascript, css, etc), the only thing I will update is the repository where my posts (markdown files) are as I add a new post.
I think the workflow to adopt is something like:
Do I have to recreate a new image and container just for a new blog post added?
How can I trigger those actions in my server when the changes are pushed? Which tools should I use?
Upvotes: 0
Views: 2205
Reputation: 36
to trigger a push event you can use hooks.
https://githooks.com/
If you don't want to build a new image every time you add a blog post, you could map the markdowns path to your host. This way you can just put a new markdown file into the mapped volume on your host and your container can use it.
https://docs.docker.com/storage/volumes/
Example:
Add following options to your run order.
docker run ... -v /docker/data/...:/data
Hope this helps.
Upvotes: 2