added deployment article

This commit is contained in:
Stephan Dörfler 2020-01-24 07:22:28 +01:00
parent cc742a0e02
commit 750dc461f2
2 changed files with 10 additions and 2 deletions

View File

@ -26,4 +26,12 @@ I let gatsby create an instance of the blog template for me. From this template
# How this is run # How this is run
I mentioned `docker` before. [It seems to be officially supported](https://github.com/gatsbyjs/gatsby-docker). I just went with the documentation and tried to get it to run. I mentioned `docker` before. [It seems to be officially supported](https://github.com/gatsbyjs/gatsby-docker). I just went with the documentation and tried to get it to run. First, I created a `Dockerfile` in the project with just one line of content:
FROM gatsbyjs/gatsby:onbuild
Then, I could build first the gatsby project with `npx gatsby build` and use the optimized output from that to build a docker image with `docker build -t while-false/blog .` from the context of my project root. Next, I started a container from the newly created image with `docker run -d --name blog -p 8080:80 while-false/blog`. It worked on my laptop for `localhost:8080`, I saw the blog I just built. Nice!
But a blog only for myself on my laptop is a bit boring. So I went on to deploy it on my server (where you are probably reading it right now). I went for the low-tech solution first: I `ssh`d into the server, cloned the git repo, built the gatsby project, built the docker image and spun it up behind my nginx reverse proxy (which I will discuss in a future blog article).
That's it for a short overview. Maybe I will show some details in the future, let me know if you have specific questions.

View File

@ -1,5 +1,5 @@
body { body {
background-color: '#e3dcc2' background-color: #e3dcc2;
} }
code { code {