blog updates
This commit is contained in:
parent
36a642900f
commit
7825d4d5e4
|
@ -1,12 +1,9 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
FROM ruby:3.2
|
||||
WORKDIR /app
|
||||
COPY Gemfile /app/Gemfile
|
||||
|
||||
# Add a script to be executed every time the container starts.
|
||||
COPY entrypoint.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/entrypoint.sh
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
EXPOSE 4000
|
||||
|
||||
# Configure the main process to run when running the image
|
||||
|
|
|
@ -18,7 +18,7 @@ landed on Jekyll, so this is also where you're reading this on now. To be honest
|
|||
I don't have too much expertise on the topic, but I made it work, and a Blog
|
||||
needs posts.
|
||||
|
||||
## Pros and Cons of Jekyll
|
||||
## Pros of Jekyll
|
||||
|
||||
### Dead Simple
|
||||
|
||||
|
@ -36,7 +36,7 @@ A large collection of Jekyll themes can be found
|
|||
[here](http://jekyllthemes.org/) (note: this site does not use HTTPS for
|
||||
some reason).
|
||||
|
||||
---
|
||||
## Cons of Jekyll
|
||||
|
||||
### Multilingual sucks
|
||||
|
||||
|
@ -44,3 +44,73 @@ With the chirpy theme at least, I couldn't get Multilingual content to work
|
|||
without going into the rabbit hole. You can select from a good amount of main
|
||||
languages, but you cannot have multiple versions of your website for various
|
||||
languages in a single project.
|
||||
|
||||
Various projects for multilingual Jekyll sites exist, but the only one that
|
||||
seems to be still maintained is [polyglot](https://github.com/untra/polyglot).
|
||||
|
||||
## Deployment with Docker
|
||||
|
||||
The "official" Jekyll Docker container is unmaintained since 2022, so if you
|
||||
want to deploy Jekyll with docker you need to create your own container. I based
|
||||
this on the standard [ruby image](https://hub.docker.com/_/ruby/).
|
||||
|
||||
We can use a `Dockerfile` like this:
|
||||
|
||||
```Dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM ruby:3.2
|
||||
WORKDIR /app
|
||||
|
||||
# Add a script to be executed every time the container starts.
|
||||
COPY entrypoint.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/entrypoint.sh
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
EXPOSE 4000
|
||||
```
|
||||
{: file="Dockerfile" }
|
||||
|
||||
We need to mount our Jekyll project to `/app`, it is not included with this
|
||||
Dockerfile.
|
||||
{: .prompt-tip }
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
git config --global --add safe.directory /app
|
||||
rm -f /app/tmp/pids/server.pid
|
||||
gem update --system
|
||||
bundle install
|
||||
|
||||
# Then exec the container's main process (what's set as CMD in the Dockerfile or
|
||||
# as command in the docker-compose.yml).
|
||||
exec "$@"
|
||||
```
|
||||
{: file="entrypoint.sh" }
|
||||
|
||||
We can then use a `docker-compose.yml`{: .filepath} file to deploy our config
|
||||
|
||||
```yaml
|
||||
services:
|
||||
jekyll:
|
||||
build: .
|
||||
volumes:
|
||||
- .:/app
|
||||
container_name: jekyll
|
||||
ports:
|
||||
- 127.0.0.1:4000:4000
|
||||
command: bundle exec jekyll serve --host 0.0.0.0 --port 4000 --liveserve
|
||||
```
|
||||
{: file="docker-compose.yml" }
|
||||
|
||||
> Remove the `--liveserve` flag for production environments, or if hosting with a
|
||||
> reverse proxy. Be sure to rebuild the image if needed. Otherwise, the
|
||||
> connection might wait for the `liveserve` port (which will probably not exist).
|
||||
{: .prompt-warning }
|
||||
|
||||
Now you should be able to start the docker container with Jekyll inside by using
|
||||
`docker compose up`. Access your site on [localhost:4000](http://localhost:4000).
|
||||
|
||||
> The source code for this website is public at
|
||||
> [git.cscherr.de](https://git.cscherr.de/PlexSheep/krata). It uses Docker too!
|
||||
{: .prompt-info }
|
||||
|
|
|
@ -11,6 +11,11 @@ to services that I host myself.
|
|||
# Self-hosted
|
||||
|
||||
* [git.cscherr.de](https://git.cscherr.de) - Primary source for software by me
|
||||
* [search.cscherr.de](https://search.cscherr.de) - Search with multiple
|
||||
search engines at once - without being tracked and without ads
|
||||
* [static.cscherr.de](https://search.cscherr.de) - Static content like images
|
||||
* [auth.cscherr.de](https://search.cscherr.de) - Single Sign On, in case you're
|
||||
blessed with an account for [cscherr.de](https://cscherr.de)
|
||||
|
||||
# Notes
|
||||
|
||||
|
|
Loading…
Reference in New Issue