-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
78 lines (59 loc) · 2.92 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
###BEGINNING/COLLABORATING WITH NEW DOCKER/JEKYLL PROJECT###
#====================================#
## 0. Set Shell JEKYLL_VERSION
# export JEKYLL_VERSION=4.0
## 1. Creating a New Project with Docker
# docker run --rm --volume="$PWD:/srv/jekyll" -it jekyll/jekyll:$JEKYLL_VERSION jekyll new mynewproject
## 2. Serving the Blog
# docker run --name mynewproject --volume="$PWD:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll:$JEKYLL_VERSION jekyll serve --watch --drafts
## 3. [optional] Building an Existing Site for PRODUCTION _site directory
# docker run --rm --volume="$PWD:/srv/jekyll" -it jekyll/jekyll:$JEKYLL_VERSION jekyll build --trace
## 4. Setup docker-compose commands for easy & quicker docker container management [docker-compose --help]
## Create and start containers in relative directory
# docker-compose up
## Stop and remove containers, networks, images, and volumes
# docker-compose down
## Start docker services
# docker-compose start
## Stop docker services
# docker-compose stop
#====================================#
## Executing commands in the docker container
# docker exec -ti myblog gem install "jekyll-theme-hydeout"
## Removing docker container
# docker rm -f myblog
## Serve docker-compose container in . OR Serve manually
## docker-compose up
# docker run --name myblog --volume="$PWD:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll:$JEKYLL_VERSION jekyll serve --watch --drafts
## Discover container ID
# docker container ls
## Executing a shell in the container
# docker exec -ti 2d5913b926fc /bin/sh
## Copy template from docker jekyll site container shell
# cp -R /usr/local/bundle/gems/minima-2.5.1/ /srv/jekyll
# Change ownership from root to user:group after exit shell
## sudo chown -R username:group foldername/
#Command Options
## command: 'jekyll serve --watch --drafts --verbose --trace'
#====================================#
## Steps to install packages within docker container; as an example, we need imageMagick with jekyll_picture_tag plugin to convert images in required format.
# 0. After docker & docker-compose have been setup and running with JEKYLL
# 1. (discover container ID's & copy ID for step 3) docker container ls --all
# 2. (in relative jekyll website directory) docker-compose up
# 3. (While docker container is running, sh into docker image) Open new terminal > docker exec -ti e1906de4a037 /bin/sh (Note: replace container ID with yours)
# 4. (Once logged into the Docker container RUN) apk --update add imagemagick
# 5. (Verify package has been installed) convert --version
# 6. Test jekyll_picture_tag plugin via {% picture test.jpg %}
#====================================#
version: '3'
services:
jekyll-serve:
image: jekyll/jekyll:4.2.2
volumes:
- '.:/srv/jekyll'
ports:
- 4000:4000
environment:
- STRAPI_BOT_USER_EMAIL=$STRAPI_BOT_USER_EMAIL
- STRAPI_BOT_USER_PASS=$STRAPI_BOT_USER_PASS
command: jekyll serve --lsi --watch --verbose --trace