Build clean Docker image issue

Hello everyone.
Due to my setup requirement, i have to make custom Docker image for our GHost appliance. At the moment we are trying to pack basic GHost into container. We are using Teamcity to build our image. And we faced following issue: Teamcity makes git clone with submodules like casper theme and admin client.
It successfully builds an image and deploy it on target sever. Next it trying to start it and im getting an error like this in console output:

[2021-09-20 18:44:14] INFO Ctrl+C to shut down
[2021-09-20 18:44:14] INFO Ghost server started in 0.588s
[2021-09-20 18:44:15] INFO Database is in a ready state.
[2021-09-20 18:44:15] INFO Ghost database ready in 0.978s
[2021-09-20 18:44:16] ERROR The currently active theme "casper" has fatal errors.

The currently active theme "casper" has fatal errors.

Error ID:
    c1d8b010-1a42-11ec-8568-7fffbbee3a39

Details:
    checkedVersion: 4.x
    path:           /ghost/content/themes/casper
    errors: 
      - 
        fatal:    true
        level:    error
        rule:     A template file called <code>index.hbs</code> must be present
        details:  Your theme must have a template file called <code>index.hbs</code>.<br>Read <a href="https://ghost.org/docs/api/handlebars-themes/context/" target=_blank>here</a> more about the required template structure and <code>index.hbs</code> in <a href="https://ghost.org/docs/api/handlebars-themes/context/index/" target=_blank>particular</a>.
        path:     index.hbs
        failures: 
          - 
            ref: index.hbs
        code:     GS020-INDEX-REQ
      - 
        fatal:    true
        level:    error
        rule:     A template file called <code>post.hbs</code> must be present
        details:  Your theme must have a template file called <code>index.hbs</code>.<br>Read <a href="https://ghost.org/docs/api/handlebars-themes/templates" target=_blank>here</a> more about the required template structure and <code>post.hbs</code> in <a href="https://ghost.org/docs/api/handlebars-themes/templates#section-post-hbs" target=_blank>particular</a>.
        path:     post.hbs
        failures: 
          - 
            ref: post.hbs
        code:     GS020-POST-REQ
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> file should be present
        details:  You should provide a <code>package.json</code> file for your theme.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> to see which properties are required and which are recommended.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-REQ
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> file can be parsed
        details:  Your <code>package.json</code> file couldn't be parsed. This is mostly caused by a missing or unnecessary <code>','</code> or the wrong usage of <code>'""'</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.<br>A good reference for your <code>package.json</code> file is always the latest version of  <a href="https://github.com/TryGhost/Casper/blob/master/package.json" target=_blank>Casper</a>.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-PARSE
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"name"</code> is required
        details:  Please add the property <code>"name"</code> to your <code>package.json</code>. E.g. <code>{"name": "my-theme"}</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> to see which properties are required and which are recommended.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-NAME-REQ
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"name"</code> must be lowercase
        details:  The property <code>"name"</code> in your <code>package.json</code> file must be lowercase.<br>Good examples are: <code>"my-theme"</code> or <code>"theme"</code> rather than <code>"My Theme"</code> or <code>"Theme"</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-NAME-LC
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"name"</code> must be hyphenated
        details:  The property <code>"name"</code> in your <code>package.json</code> file must be hyphenated.<br>Please use <code>"my-theme"</code> rather than <code>"My Theme"</code> or <code>"my theme"</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-NAME-HY
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"version"</code> must be semver compliant
        details:  The property <code>"version"</code> in your <code>package.json</code> file must be semver compliant. E.g. <code>{"version": "1.0.0"}</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-VERSION-SEM
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"version"</code> is required
        details:  Please add the property <code>"version"</code> to your <code>package.json</code>. E.g. <code>{"version": "1.0.0"}</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> to see which properties are required and which are recommended.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-VERSION-REQ
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"author.email"</code> must be valid
        details:  The property <code>"author.email"</code> in your <code>package.json</code> file must a valid email. E.g. <code>{"author": {"email": "hello@example.com"}}</code>.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-AUT-EM-VAL
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"author.email"</code> is required
        details:  Please add the property <code>"author.email"</code> to your <code>package.json</code>. E.g. <code>{"author": {"email": "hello@example.com"}}</code>.<br>The email is required so that themes which are distributed (either free or paid) have a method of contacting the author so users can get support and more importantly so that>Ghost can reach out about breaking changes and security updates.<br>The <code>package.json</code> file is <strong>NOT</strong> accessible when uploaded to a blog so if the theme is only uploaded to a single blog, no one will see this email address.<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> to see which properties are required and which are recommended.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-AUT-EM-REQ
      - 
        fatal:    false
        level:    error
        rule:     <code>package.json</code> property <code>"engines.ghost-api"</code> is incompatible with current version of Ghost API and will fall back to "v4"
        details:  Please change <code>"ghost-api"</code> in your <code>package.json</code> to higher version. E.g. <code>{"engines": {"ghost-api": "v4"}}</code>.<br>If <code>"ghost-api"</code> property is left at "v0.1", Ghost will use its default setting of "v4".<br>Check the <a href="https://ghost.org/docs/api/handlebars-themes/packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.
        failures: 
          - 
            ref: package.json
        code:     GS010-PJ-GHOST-API-V01
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-width-wide</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-width-wide</code> CSS class is required otherwise wide images will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#image-size-implementations" target=_blank>here</a>.
        regex: 
        className: .kg-width-wide
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGWW
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-width-full</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-width-full</code> CSS class is required otherwise full width images will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#image-size-implementations" target=_blank>here</a>.
        regex: 
        className: .kg-width-full
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGWF
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-gallery-container</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-gallery-container</code> CSS class is required otherwise galleries will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#gallery-card" target=_blank>here</a>.
        regex: 
        className: .kg-gallery-container
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGGC
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-gallery-row</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-gallery-row</code> CSS class is required otherwise gallery rows will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#gallery-card" target=_blank>here</a>.
        regex: 
        className: .kg-gallery-row
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGGR
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-gallery-image</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-gallery-image</code> CSS class is required otherwise gallery images will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#gallery-card" target=_blank>here</a>.
        regex: 
        className: .kg-gallery-image
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGGI
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-card</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-card</code> CSS class is required otherwise the bookmark card will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-card
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBM
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-container</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-card</code> CSS class is required otherwise the bookmark card will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-container
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMCO
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-content</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-content</code> CSS class is required otherwise the bookmark card main content will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-content
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMCON
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-title</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-title</code> CSS class is required otherwise the bookmark card title will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-title
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMTI
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-description</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-description</code> CSS class is required otherwise the bookmark card description will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-description
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMDE
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-metadata</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-metadata</code> CSS class is required otherwise the bookmark card meta details will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-metadata
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMME
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-icon</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-icon</code> CSS class is required otherwise the bookmark card author icon will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-icon
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMIC
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-author</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-author</code> CSS class is required otherwise the bookmark card author name will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-author
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMAU
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-publisher</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-publisher</code> CSS class is required otherwise the bookmark card publisher name will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-publisher
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMPU
      - 
        fatal:     false
        level:     error
        rule:      The <code>.kg-bookmark-thumbnail</code> CSS class is required to appear styled in your theme
        details:   The <code>.kg-bookmark-thumbnail</code> CSS class is required otherwise the bookmark card thumbnail image will appear unstyled.Find out more about required theme changes for the Koenig editor <a href="https://ghost.org/docs/api/handlebars-themes/editor/#bookmark-card" target=_blank>here</a>.
        regex: 
        className: .kg-bookmark-thumbnail
        css:       true
        failures: 
          - 
            ref: styles
        code:      GS050-CSS-KGBMTH

----------------------------------------

ThemeValidationError: The currently active theme "casper" has fatal errors.
    at Object.getThemeValidationError (/ghost/core/server/services/themes/validate.js:69:12)
    at Object.module.exports.loadAndActivate (/ghost/core/server/services/themes/activate.js:27:36)
    at async initFrontend (/ghost/core/boot.js:122:5)
    at async bootGhost (/ghost/core/boot.js:329:9)

I was thought that something wrong with GHost files inside of repo and checked TC agent - all files are there and it means that submodule init has been success.
I was checked in Docker container and its not in it. How it could happend?

Please advice any solution.
p.s. my docker file looks like this:

#
# Ghost Dockerfile
#
# https://github.com/dockerfile/ghost
#


# Pull base image.
FROM ubuntu:rolling

#RUN apt-get install apt-utils
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y curl sudo apt-utils unzip git
RUN apt-get update -y && apt-get upgrade -y
RUN curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
RUN apt -y install nodejs make gcc g++ wget

# Install Ghost
ARG XXX
ARG XXX
 
RUN mkdir -p /ghost-source

RUN \
  cd /ghost-source && \
  git clone https://ZZZZZZ/ghost-blog.git .

RUN cp -r /ghost-source /ghost  

RUN cd /ghost && npm install --production && \
sed 's/127.0.0.1/0.0.0.0/' /ghost/config.development.json > /ghost/config.js && \
useradd ghost --home /ghost
RUN npm install -g npm@7.22.0
RUN npm install -g ghost-cli

# Mount volumes.
VOLUME /ghost-override
#VOLUME /content

# Define working directory.
WORKDIR /ghost

# Add files.
ADD start.sh /ghost-start

# Expose ports.
EXPOSE 2368

# Define an entry point.
#ENV NODE_ENV=production
CMD ["bash", "/ghost-start"]

1 Like

How did you solve this?

Not solved yet