V3 Deployment to prod with Docker

Hi everybody,

I would like to start this feed regarding the Docker setup for the OctoberCMS production enviroment.
But in the beginning let me share a simple setup we’ve come so far for the demo page with some questions and comments.

The main goal: To have a dev & prod isolated enviroments with Volumes for DB and probably /storage & /themes (with PhpMyAdmin preferably).

Issues for the moment:

  • /storage is not persistent
  • Need to have nginx on the server to route domains and forward to 8080 with CertBot.
  • Not really clear how to setup nginx instead of Apache inside the container
  • Since octobercms/october-dev comes with Apache installed it would be nice to stop (for performance reasons) and use nginx

Any advice or comment on this would be very helpful.

Here is our Dockerfile:

FROM octobercms/october-dev:latest
WORKDIR /var/www/html

## later we can copy our project files here like: 
# COPY ./plugins ./plugins
## Or pull the project from git and run 
# RUN composer up
# RUN php artisan october:migrate

And here is the docker-compose.yml

version: "3.8"
services:

  ## Our backend
  backend:
    build:
      context: ./
    ports:
      - "8080:80"
      # - "3307:3306"

  ## Own MariaDB server just for volume persistance
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: 'db'
      # Buil in user
      MYSQL_USER: 'user'
      MYSQL_PASSWORD: 'password'
      MYSQL_ROOT_PASSWORD: 'password'
    ports:
      - '3307:3306'
    ## not nice, but will work as temp solution
    expose:
      - '3306'
    volumes:
      - my-db:/var/lib/mysql

  ## From official phpmyadmin doc.
  phpmyadmin:
    image: phpmyadmin
    restart: always
    ports:
      - 8081:80
    environment:
      - PMA_ARBITRARY=1

# Names our volume
volumes:
  my-db:

Hey @mrmax

We don’t have an official production docker image, only one for development at the moment. Here is an interesting repo that might help with creating a production image:

1 Like