3

I'm trying to deploy a Dockerized Craft CMS website. The basic setup is as follows:

  • craft running in Docker
  • nginx running on the server, using proxy_pass to point to docker container

The setup itself seems to work, but Craft throws /app/web/cpresources doesn’t exist or isn’t writable by PHP when visiting the website (temporarily running dev mode on server to debug).

So far, to me this seems like a permissions issue. But I don't know how to properly solve it. Locally (MacBook Pro), this all works fine. It's on the server (Ubuntu 20.04) I suddenly encounter this issue.

docker-compose.yml

version: '3.6'

services:
  app:
    build:
      context: .
      dockerfile: ./.docker-config/php/Dockerfile
    container_name: app
    env_file: .env
    volumes:
      - ./.app-data/craft/web/cpresources:/app/web/cpresources
      - ./.app-data/craft/web/images:/app/web/images
    restart: unless-stopped

  nginx:
    build:
      context: .
      dockerfile: ./.docker-config/nginx/Dockerfile
    container_name: nginx
    ports:
      - 8000:80
    volumes:
      - ./.app-data/craft/web/cpresources:/app/web/cpresources
      - ./.app-data/craft/web/images:/app/web/images
    restart: unless-stopped

  database:
    image: postgres:12.4-alpine
    container_name: database
    env_file: .env
    volumes:
      - ./.app-data/database:/var/lib/postgresql/data
    restart: unless-stopped

  adminer:
    image: adminer:4.7.7-standalone
    container_name: adminer
    ports:
      - 8080:8080

Dockerfile (Craft)

FROM composer:2.0.4 as vendor
COPY ./craft/composer.json composer.json
COPY ./craft/composer.lock composer.lock
RUN composer install --ignore-platform-reqs --no-interaction --prefer-dist

FROM craftcms/php-fpm:7.4
COPY --chown=www-data:www-data --from=vendor /app/vendor/ /app/vendor/
COPY --chown=www-data:www-data ./craft/ .

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.