PHPfox-Official / phpfox-v4-feature-requests

phpFox Feature Request Tracker https://phpfox.com
6 stars 12 forks source link

Add Dockerfile (provided) to expand phpFox's hosting options #1023

Open zackees opened 1 year ago

zackees commented 1 year ago

Update: See this repo for complete docker demo:

https://github.com/zackees/docker-phpFox4

About

This dockerfile is a great starting point to get phpFox v4 on the new Platform-as-a-Service hosts. In it's current state it works well for localhost development.

Installation

phpFox must be unzipped to the app directory:

/
├── app/
│   ├── PF.Base
│   ├── ...
│   ├── index.php
└── Dockerfile

All phpFox requirements will be satisifed with this build, but two of the recommended settings will not be active:

Dockerfile

# Popular DockerLAMP base image has +1M pulls
FROM mattrayner/lamp:latest-2004-php8

ENV PHP_UPLOAD_MAX_FILESIZE 100M
ENV PHP_POST_MAX_SIZE 100M

RUN apt-get update && apt-get install -y \
    sudo curl ca-certificates \
    tar file xz-utils build-essential

# BEGIN REDIS PORTION
# Note this is a work-in-progress and phpFox v4 does not show
# that redis is working properly.
RUN apt-get install -y nodejs
# This results in an error because the target folder exists
# so disabled for now.
# RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN apt-get install -y npm redis-server
RUN npm update && npm install
# END REDIS PORTION

# Image magic extension to allow uploads of different image types.
RUN apt-get install -y php8.0-imagick

# mattrayner/lamp image assumes /app as the web root
WORKDIR /app
COPY app .

# Per phpFox v4 documentation, the following is required
RUN chmod 777 PF.Base
RUN chmod 777 PF.Site

# Note that the ports 80 and 3306 are exposed by the base image.
# EXPOSE 80 3306
# No CMD argument because the mattrayner/lamp image has it, which
# will run /app/index.php

Building

To build the app image go to the root of the directory and type in:

docker build -t phpfox .

Running

docker run -dp 80:80 -p 3306:3306 phpfox

And you should see this at http://localhost:80:

image