Can I run production env when clone git repo?

I clone 5.79.4 and I want to run ghost with production environment
(In aws ecs docker)

I cannot use docker installation because I should modify core logics for our necessity.

So I clone GitHub - TryGhost/Ghost: Independent technology for modern publishing, memberships, subscriptions and newsletters. and run yarn dev
It runs perfectly but it is debug mode.

So, I need to run it by production mode from source.
Is there any solutions?

Document has only commands for development mode.

As far as I’m aware, if you want to create a release build of Ghost, you need to run yarn build and then yarn archive in the project root.

And then should I use ghost-5.79.4.tgz?

I just want to run ghost server with production environment in terminal

It was available when ghost is legacy version like v3

"start": "node index",
"dev": "DEBUG=ghost:* grunt dev",

You will receive an archive in /ghost/core in the format ghost-x.xx.x.tgz. This archive can then be used to install Ghost with the CLI using the --archive flag:

Oh I see…

Then I have two more question.

  1. s3 adapter in ghost/content/adapters is not archived in tgz. Is there anything guides?

  2. I want to set environment in terminal like
    “database__connection__user=root yarn dev”
    When I do ‘yarn build’ and ‘yarn archive’, How can I insert arguments?

I am building my own Docker images with a modified core, where I also use an S3 adapter.

My steps are basically this (which you should be able to replicate outside of Docker as well).

  1. Install the archive with the Ghost CLI with the --no-start flag, so Ghost doesn’t immediately start after the installation
  2. Copy my config.production.json to the Ghost directory
  3. Copy the S3 adapter to the proper directory
  4. Set the configuration for the S3 adapter using environment variables
  5. Start Ghost

Works without issues for me.

For your second question regarding the environment – not entirely sure what you’re trying to do here? Adding yarn dev to an environment variable that’s meant for the database connection makes little sense to me.

What exactly are you trying to achieve? Generally, you’d set the environment well…in the environment you’re trying to run an application, not when you build its assets.

When I use ghost v3, I deploy our product like this

  1. CI tool pull our ghost repository (with adapter) in docker container.
  2. build (npm run build)
  3. run (npm run start)
  4. push docker image to aws
  5. Finished!

But in ghost v5, there is no production run mode so I encountered many difficulties.

I don’t know yet why I should make archive to run ghost.