Skip to content

add ghost v2 docker images #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2018
Merged

Conversation

acburdine
Copy link
Collaborator

closes #142

Main difference from ghost v1 is that knex-migrator is no longer needed outside of Ghost - Ghost itself will run it on boot.

@acburdine acburdine requested review from tianon and yosifkit August 22, 2018 12:34
@acburdine acburdine changed the title add ghost v2 docker image add ghost v2 docker images Aug 22, 2018
mkdir -p "$GHOST_CONTENT"; \
chown node:node "$GHOST_CONTENT"

# TODO multiarch sqlite3 (once either "node:6-alpine" has multiarch or we switch to a base that does)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, probably time to revisit this (although not going to hold this up to do so). 👍

@tianon
Copy link
Member

tianon commented Aug 22, 2018

Here's a slightly better diff: (since GitHub doesn't support --find-copies-harder through the web interface)

diff --git a/.travis.yml b/.travis.yml
index ac01164..31869e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,8 @@ language: bash
 services: docker
 
 env:
+  - VERSION=2 VARIANT=debian
+  - VERSION=2 VARIANT=alpine
   - VERSION=1 VARIANT=debian
   - VERSION=1 VARIANT=alpine
   - VERSION=0 VARIANT=debian
diff --git a/1/alpine/Dockerfile b/2/alpine/Dockerfile
similarity index 77%
copy from 1/alpine/Dockerfile
copy to 2/alpine/Dockerfile
index 847add9..1fc8a6c 100644
--- a/1/alpine/Dockerfile
+++ b/2/alpine/Dockerfile
@@ -17,7 +17,7 @@ RUN npm install -g "ghost-cli@$GHOST_CLI_VERSION"
 ENV GHOST_INSTALL /var/lib/ghost
 ENV GHOST_CONTENT /var/lib/ghost/content
 
-ENV GHOST_VERSION 1.25.5
+ENV GHOST_VERSION 2.0.3
 
 RUN set -ex; \
 	mkdir -p "$GHOST_INSTALL"; \
@@ -37,14 +37,7 @@ RUN set -ex; \
 # need to save initial content for pre-seeding empty volumes
 	mv "$GHOST_CONTENT" "$GHOST_INSTALL/content.orig"; \
 	mkdir -p "$GHOST_CONTENT"; \
-	chown node:node "$GHOST_CONTENT"; \
-	\
-# sanity check to ensure knex-migrator was installed
-	"$GHOST_INSTALL/current/node_modules/knex-migrator/bin/knex-migrator" --version
-
-# add knex-migrator bins into PATH
-# we want these from the context of Ghost's "node_modules" directory (instead of doing "npm install -g knex-migrator") so they can share the DB driver modules
-ENV PATH $PATH:$GHOST_INSTALL/current/node_modules/knex-migrator/bin
+	chown node:node "$GHOST_CONTENT"
 
 # TODO multiarch sqlite3 (once either "node:6-alpine" has multiarch or we switch to a base that does)
 
diff --git a/1/alpine/docker-entrypoint.sh b/2/alpine/docker-entrypoint.sh
similarity index 89%
copy from 1/alpine/docker-entrypoint.sh
copy to 2/alpine/docker-entrypoint.sh
index 21eee25..bedd4fa 100755
--- a/1/alpine/docker-entrypoint.sh
+++ b/2/alpine/docker-entrypoint.sh
@@ -17,8 +17,6 @@ if [[ "$*" == node*current/index.js* ]]; then
 			tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")"
 		fi
 	done
-
-	knex-migrator-migrate --init --mgpath "$GHOST_INSTALL/current"
 fi
 
 exec "$@"
diff --git a/1/debian/Dockerfile b/2/debian/Dockerfile
similarity index 87%
copy from 1/debian/Dockerfile
copy to 2/debian/Dockerfile
index a834190..8c8e63a 100644
--- a/1/debian/Dockerfile
+++ b/2/debian/Dockerfile
@@ -23,7 +23,7 @@ RUN npm install -g "ghost-cli@$GHOST_CLI_VERSION"
 ENV GHOST_INSTALL /var/lib/ghost
 ENV GHOST_CONTENT /var/lib/ghost/content
 
-ENV GHOST_VERSION 1.25.5
+ENV GHOST_VERSION 2.0.3
 
 RUN set -ex; \
 	mkdir -p "$GHOST_INSTALL"; \
@@ -43,14 +43,7 @@ RUN set -ex; \
 # need to save initial content for pre-seeding empty volumes
 	mv "$GHOST_CONTENT" "$GHOST_INSTALL/content.orig"; \
 	mkdir -p "$GHOST_CONTENT"; \
-	chown node:node "$GHOST_CONTENT"; \
-	\
-# sanity check to ensure knex-migrator was installed
-	"$GHOST_INSTALL/current/node_modules/knex-migrator/bin/knex-migrator" --version
-
-# add knex-migrator bins into PATH
-# we want these from the context of Ghost's "node_modules" directory (instead of doing "npm install -g knex-migrator") so they can share the DB driver modules
-ENV PATH $PATH:$GHOST_INSTALL/current/node_modules/knex-migrator/bin
+	chown node:node "$GHOST_CONTENT"
 
 RUN set -eux; \
 # force install "sqlite3" manually since it's an optional dependency of "ghost"
diff --git a/1/debian/docker-entrypoint.sh b/2/debian/docker-entrypoint.sh
similarity index 89%
copy from 1/debian/docker-entrypoint.sh
copy to 2/debian/docker-entrypoint.sh
index 1060b05..c7bfbe3 100755
--- a/1/debian/docker-entrypoint.sh
+++ b/2/debian/docker-entrypoint.sh
@@ -17,8 +17,6 @@ if [[ "$*" == node*current/index.js* ]]; then
 			tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")"
 		fi
 	done
-
-	knex-migrator-migrate --init --mgpath "$GHOST_INSTALL/current"
 fi
 
 exec "$@"

@tianon tianon merged commit 821c36a into docker-library:master Aug 22, 2018
@tianon
Copy link
Member

tianon commented Aug 22, 2018

(The parts that are gone are some of the parts that have been the most annoying!! 🎉 ❤️)

tianon added a commit to infosiftr/stackbrew that referenced this pull request Aug 22, 2018
- `docker`: 18.06.1-ce GA
- `ghost`: Ghost 2.0! (docker-library/ghost#145)
- `golang`: remove unused files (docker-library/golang#232)
- `postgres`: add `stretch-backports` when building 11+ from source (docker-library/postgres#485)
@crespum
Copy link

crespum commented Aug 26, 2018

The image works when deploying a new Ghost instance, however it doesn't work when updating from a previous Ghost v1 blog because it doesn't migrate the old DB. To be more precise, the problem is the new comment_id field. Is there any way to solve this?

@acburdine acburdine deleted the feat/ghost-v2 branch August 27, 2018 01:26
@tianon
Copy link
Member

tianon commented Aug 30, 2018

See #147, especially #147 (comment):

Did you by chance try to update to 2.x from a 1.x release < 1.25.4? In Ghost-CLI we added a provision that prevented updates if you were not already running the latest 1.x version of Ghost, and my guess is that the errors you're seeing are related to the fact that you need to upgrade to the latest 1.x version first before trying the 2.x upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ghost 2.0 release
3 participants