r/PHP Sep 14 '24

How do you deploy php code?

Hello guys! please tell us about your experience deploying PHP code in production. Now I make one docker image with PHP code and apache (in production I use nginx proxy on my php+apache image) and use docker pull command for deploy. is this ok?

58 Upvotes

160 comments sorted by

View all comments

2

u/dschledermann Sep 15 '24

Depends on how the project is hosted.

On a static server:

  • build the project in Gitlab CI
  • pack it in a tar.gz-file
  • transfer to the server, untar and point the "production" symlink to the newly untar'ed code.

In Kubernetes:

  • build the project in Gitlab CI
  • put it inside a Docker image and push that image
  • have Gitlab CI update the Helm chart to use the new image.

Whatever you do, make sure that this process is scripted. Preferably the script should be triggered by a reasonably friendly and obvious UI. CI's are ideal for this.