docker run -d -P adolphlwq/docker-ghost
or:
docker run -d -p host_port:2368 adolphlwq/docker-ghost
git clone https://github.com/adolphlwq/ghost-blog.git
vim config.development.json
change/add some config
:wq
docker build -t repo/image_name:tag .
# OR use command make
make build-dev (build a image for dev and test env)
# OR
make build-prod (build a image for prod env)
docker run -d -p host_port:2368 image_name
# OR use make
make dev (setup ghost on dev env)
# OR
make prod (setup ghost on prod env)
I suggest you map a volumn from container to host when run ghost image.
docker run -d --name ghost -p 2368:2368 -v host_path_to_data:/var/www/ghost/content/data ghost
Note: It is useful on Linux
#!/bin/bash
DATA_DIR=$1 #data dir to backup
STORE_DIR=$2 #data dir to store backup date
tar zcvf ${STORE_DIR}/ghost_content_data_`date "+%Y_%m_%d_%H_%M_%S"`.tar.gz ${DATA_DIR}
crontab -e
# m h dom mon dow command
30 3 * * * path/to/ghost_blog_data_backup.sh path/to/DATA_DIR path/to/STORE_DIR
edit crontab -e on Linux
0 0 1 */2 * letsencrypt renew
In this section,I will set up a SSL by [Let's Encrypt](https://letsencrypt.org/) and [Nginx](http://nginx.org).
It is easy, I skip
server {
listen 80;
server_name example.com www.example.com;
location / {
index index.html;
}
}
detail info See Here
Let's Encript CA
[sudo] letsencrypt certonly --webroot -w /var/www/ghost -d example.com -s www.example.com
click here to learn more from certbot ACME client.
server {
listen 80;
server_name example.com www.example.com;
root path/to/root;
ssl on;
listen 443 ssl;
ssl_certificate path/to/cert;
ssl_certificate_key path/to/cert_key;
ssl_session_timeout 30m;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:2368;
}
location ~ /.well-known {
allow all;
}
}
Let's Encrypt.Content type
Image
Digest
Size
149.7 MB
Last updated
about 8 years ago
docker pull adolphlwq/docker-ghost