Guys, i've created a container for Flarum by myself, just to learn something.
my steps.
- Create empty folder and launch a new project for
flarum composer create-project flarum/flarum .
- Create a Dockerfile with necessary config
FROM php:8.1-apache
# Install necessary extensions
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd pdo pdo_mysql zip
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Set up Flarum
RUN mkdir /var/www/flarum
COPY . /var/www/flarum
RUN chown -R www-data:www-data /var/www/flarum/storage
# Set up Apache
COPY apache.conf /etc/apache2/sites-available/000-default.conf
RUN chown -R www-data:www-data /var/www/flarum \
&& chown -R www-data:www-data /var/www/flarum/public/assets
WORKDIR /var/www/flarum
- Create a docker-compose.yml file with my config
version: "3"
services:
db:
image: mariadb
restart: always
environment:
MYSQL_DATABASE: flarum
MYSQL_USER: flarum_user
MYSQL_PASSWORD: flarum_password
MYSQL_ROOT_PASSWORD: root_password
volumes:
- db_data:/var/lib/mysql
web:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "8000:80"
depends_on:
- db
environment:
DB_HOST: db
DB_DATABASE: flarum
DB_USERNAME: flarum_user
DB_PASSWORD: flarum_password
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8081:80"
depends_on:
- db
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: example
volumes:
db_data:
but i have a problem here (sorry is my really first attempt). i can't use files that are in my folder.
how can i use my flarum files into my folder?
For example, if I need to modify composer.json I need to do that from
Docker terminal inside the var/www folder