1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-30 09:16:58 +02:00

update ghost

This commit is contained in:
kev 2021-02-02 18:52:08 +08:00
parent 5771e5c1c7
commit d07fcd4bbd
6 changed files with 23 additions and 104 deletions

View File

@ -12,25 +12,25 @@ ghost:
- "127.0.0.1:2368:2368" - "127.0.0.1:2368:2368"
volumes: volumes:
- ./data:/var/lib/ghost/content - ./data:/var/lib/ghost/content
- ./data/config.json:/var/lib/ghost/config.production.json environment:
restart: always - url=https://blog.easypi.duckdns.org
- database__client=sqlite3
- database__connection__filename=/var/lib/ghost/content/data/ghost.db
restart: unless-stopped
``` ```
## Up and Running ## Up and Running
```bash ```bash
$ mkdir data
$ cd data
$ wget https://github.com/vimagick/dockerfiles/raw/master/ghost/data/config.json
$ sed -i 's@http://localhost:2368@https://blog.easypi.pro@' config.js
$ docker-compose up -d $ docker-compose up -d
$ curl https://blog.easypi.duckdns.org/ghost/
``` ```
## Setup SSL ## Setup SSL
> Read [this][2] to setup SSL. > Read [this][2] to setup SSL.
``` ```nginx
server { server {
listen 80 default; listen 80 default;
server_name _; server_name _;
@ -41,11 +41,11 @@ server {
server { server {
listen 443 ssl; listen 443 ssl;
server_name easypi.pro blog.easypi.pro; server_name easypi.duckdns.org blog.easypi.duckdns.org;
ssl_certificate ssl/easypi.pro.crt; ssl_certificate ssl/easypi.duckdns.org/fullchain.pem;
ssl_certificate_key ssl/easypi.pro.key; ssl_certificate_key ssl/easypi.duckdns.org/privkey.pem;
location / { location / {
if ($host = 'easypi.pro') { if ($host = 'easypi.duckdns.org') {
return 301 $scheme://blog.$host$request_uri; return 301 $scheme://blog.$host$request_uri;
} }
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -71,4 +71,4 @@ files without editing them.
[1]: https://ghost.org/ [1]: https://ghost.org/
[2]: http://support.ghost.org/setup-ssl-self-hosted-ghost/ [2]: http://support.ghost.org/setup-ssl-self-hosted-ghost/
[3]: https://blog.easypi.pro/ghost/settings/code-injection/ [3]: https://blog.easypi.duckdns.org/ghost/settings/code-injection/

View File

@ -1,38 +0,0 @@
#
# Dockerfile for ghost-arm
#
FROM easypi/alpine-arm
MAINTAINER EasyPi Software Foundation
ENV GHOST_VERSION 2.15.0
ENV GHOST_INSTALL /var/lib/ghost
ENV GHOST_CONTENT /var/lib/ghost/content
ENV GHOST_CLI_VERSION 1.9.9
ENV NPM_CONFIG_LOGLEVEL warn
ENV NODE_ENV production
RUN set -xe \
&& addgroup -g 1000 node \
&& adduser -u 1000 -G node -s /bin/sh -D node \
&& apk add --no-cache bash build-base nodejs nodejs-npm python su-exec \
&& npm install -g --unsafe-perm ghost-cli@$GHOST_CLI_VERSION knex-migrator@latest \
&& mkdir -p $GHOST_INSTALL \
&& chown node:node $GHOST_INSTALL \
&& su-exec node ghost install $GHOST_VERSION --db sqlite3 --no-prompt --no-stack --no-setup --dir $GHOST_INSTALL \
&& cd $GHOST_INSTALL \
&& su-exec node ghost config --ip 0.0.0.0 --port 2368 --no-prompt --db sqlite3 --url http://localhost:2368 --dbpath $GHOST_CONTENT/data/ghost.db \
&& su-exec node ghost config paths.contentPath $GHOST_CONTENT \
&& mv $GHOST_CONTENT $GHOST_INSTALL/content.orig \
&& mkdir -p $GHOST_CONTENT \
&& chown node:node $GHOST_CONTENT \
&& apk del build-base python
WORKDIR $GHOST_INSTALL
VOLUME $GHOST_CONTENT
COPY docker-entrypoint.sh /usr/local/bin
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 2368
CMD ["node", "current/index.js"]

View File

@ -1,7 +1,11 @@
ghost: ghost:
image: easypi/ghost-arm image: arm32v7/ghost:alpine
ports: ports:
- "127.0.0.1:2368:2368" - "127.0.0.1:2368:2368"
volumes: volumes:
- ./data:/var/lib/ghost/content - ./data:/var/lib/ghost/content
restart: always environment:
- url=https://blog.easypi.duckdns.org
- database__client=sqlite3
- database__connection__filename=/var/lib/ghost/content/data/ghost.db
restart: unless-stopped

View File

@ -1,24 +0,0 @@
#!/bin/bash
set -e
# allow the container to be started with `--user`
if [[ "$*" == node*current/index.js* ]] && [ "$(id -u)" = '0' ]; then
chown -R node "$GHOST_CONTENT"
exec su-exec node "$BASH_SOURCE" "$@"
fi
if [[ "$*" == node*current/index.js* ]]; then
baseDir="$GHOST_INSTALL/content.orig"
for src in "$baseDir"/*/ "$baseDir"/themes/*; do
src="${src%/}"
target="$GHOST_CONTENT/${src#$baseDir/}"
mkdir -p "$(dirname "$target")"
if [ ! -e "$target" ]; then
tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")"
fi
done
knex-migrator-migrate --init --mgpath "$GHOST_INSTALL/current"
fi
exec "$@"

View File

@ -1,26 +0,0 @@
{
"url": "http://localhost:2368/",
"server": {
"port": 2368,
"host": "0.0.0.0"
},
"database": {
"client": "sqlite3",
"connection": {
"filename": "/var/lib/ghost/content/data/ghost.db"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/lib/ghost/content"
}
}

View File

@ -4,5 +4,8 @@ ghost:
- "127.0.0.1:2368:2368" - "127.0.0.1:2368:2368"
volumes: volumes:
- ./data:/var/lib/ghost/content - ./data:/var/lib/ghost/content
- ./data/config.json:/var/lib/ghost/config.production.json environment:
restart: always - url=https://blog.easypi.duckdns.org
- database__client=sqlite3
- database__connection__filename=/var/lib/ghost/content/data/ghost.db
restart: unless-stopped